Differences between revisions 3 and 4
Revision 3 as of 2008-11-15 14:00:03
Size: 323
Editor: localhost
Comment: converted to 1.6 markup
Revision 4 as of 2010-09-24 03:30:22
Size: 479
Editor: ppp118-209-23-175
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
Since Python 2.6, Python has include a standard tool 2to3 to assist in the conversion.
http://docs.python.org/library/2to3.html
Line 5: Line 8:
  * has_key changed to x in dict / dict.__contains__   * has_key changed to x in dict
Line 7: Line 10:
  * reduce() changed to functools.reduce()

Converting Python 2.x code to Python 3.x code


Since Python 2.6, Python has include a standard tool 2to3 to assist in the conversion. http://docs.python.org/library/2to3.html

Program features that need to be changed

  • has_key changed to x in dict
  • apply() removed
  • reduce() changed to functools.reduce()

Infrastructure for automatic refactoring

  • tokenize module
  • Python 2.5 compile() return ast objects

Py3kConversionTools (last edited 2010-09-24 03:30:22 by ppp118-209-23-175)

Unable to edit the page? See the FrontPage for instructions.