Menu

#5580 Replace deprecated functions from string module

Fixed
Enhancement
2019-10-25
2019-10-19
No

Replace deprecated functions from string module

These methods have been deprecated since at least Python 2.4 and their
replacements are available since at least that version.

Individual changes:
* Replace string.atoi() by int()
* Replace string.split() by str.split()
* Replace string.join() by sep.join()
* Replace string.strip() by str.strip()
* Replace string.replace() by str.replace()
* Drop now unused 'import string'

http://codereview.appspot.com/566920044

Discussion

  • Anonymous

    Anonymous - 2019-10-19
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2019-10-19

    Passes make, make check and a full make doc

     
  • Anonymous

    Anonymous - 2019-10-21
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2019-10-21

    Patch on countdown for Oct 23rd

     
  • Anonymous

    Anonymous - 2019-10-23
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2019-10-23

    Patch counted down - please push

     
    • Malte Meyn

      Malte Meyn - 2019-10-23

      I’m very late to the review party and don’t know much about python but maybe you (Jonas) could look at my questions on Rietveld before pushing?

       

      Last edit: Malte Meyn 2019-10-23
      • Jonas Hahnfeld

        Jonas Hahnfeld - 2019-10-25

        Do my answers make sense, can I go forward with pushing? If you have more questions, please let me know.

         
        • Malte Meyn

          Malte Meyn - 2019-10-25

          Yes, they do. Consistency of '' and "" with the surrounding code makes sense (maybe it would be nice to be consistent in the whole file/project, but that’s another question and would probably need a large number of changes for little benefit). I didn’t know that they are basically the same.

           
          • Jonas Hahnfeld

            Jonas Hahnfeld - 2019-10-25

            Yeah, eventually a cleanup of those would be nice, and also a global policy on whether there is a space before a function call or not. But I wouldn't want to tackle this until we have migrated to Python 3, which will be difficult enough without a global reformatting...

             
  • Anonymous

    Anonymous - 2019-10-25

    Patch counted down - please push

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-10-25
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-10-25
    commit e57c27dc14a188bfdbcf0b1af9af0564218d9cdf
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:56:26 2019 +0200
    
        Issue 5580/6: Drop now unused 'import string'
    
    commit ee6d1f8119f5a2f49ed63a668c51f6825af31bee
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:51:32 2019 +0200
    
        Issue 5580/5: Replace string.replace() by str.replace()
    
        The method is available since at least Python 2.4.
    
    commit 15a81586f70aa859de917c389a23ddaf8bd3365f
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:46:58 2019 +0200
    
        Issue 5580/4: Replace string.strip() by str.strip()
    
        The method is available since at least Python 2.4.
    
    commit a7d581df1611cf3a7d59bdd2985e31ab96d2be9f
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:41:44 2019 +0200
    
        Issue 5580/3: Replace string.join() by sep.join()
    
        The method is available since at least Python 2.4 and "the default
        value for sep is a single space character."
    
    commit 440d90310d9613856df4496a764165f1eab593ab
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:33:45 2019 +0200
    
        Issue 5580/2: Replace string.split() by str.split()
    
        The new method is available since at least Python 2.4.
    
    commit 8f95f02325a2a9d2a008a8eeb8780da5740e2c57
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Fri Oct 18 21:29:09 2019 +0200
    
        Issue 5580/1: Replace string.atoi() by int()
    
        The functions are available since Python 2.0 and take the same arguments.