Differences between revisions 2 and 8 (spanning 6 versions)
Revision 2 as of 2009-03-22 02:41:11
Size: 1024
Comment:
Revision 8 as of 2011-03-25 09:14:31
Size: 1247
Editor: techtonik
Comment: trying to organize something helpful around 2to3 mess
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
2to3 is a tool that automatically translates 2.x code to 3.x code. The code is located at http://svn.python.org/view/sandbox/trunk/2to3. At the moment, it is principally maintained by BenjaminPeterson. '''2to3''' is a tool that automatically translates [[PortingPythonToPy3k|2.x code to 3.x code]].
Line 3: Line 3:
Here are some project ideas: == Description ==
Overview: [[http://pybites.blogspot.com/2008/09/fun-with-2to3.html|Fun with 2to3]] by Benjamin Peterson<<BR>>
Line 5: Line 6:
* Some people have expressed interest in adding directives in the source to 2to3. So you could write: == Code ==
The code is located at http://svn.python.org/view/sandbox/trunk/2to3. At the moment, it is principally maintained by BenjaminPeterson. Since Python 2.6, it has been included in the standard library. http://docs.python.org/library/2to3.html
Line 7: Line 9:
  # 2to3: strings-are-bytes
  x = "hi"
  # 2to3: end
== Ideas ==
 * Some people have expressed interest in adding directives in the source to 2to3. So you could write:
 {{{
 # 2to3: strings-are-bytes
 x = "hi"
 # 2to3: end
 }}}
 and that would get translated to
Line 11: Line 18:
  and that would get translated to  {{{x = b"hi"}}}
Line 13: Line 20:
  x = b"hi"  * Last year there was a project to add confidence rankings to 2to3 changes. People could configure them to a certain level and deal with low confidence refactoring manually (or interactively). For some reason, the project was never finished. If you want to find more out about that, I suggest you contact [[http://isnomore.net/2to3|the student]] or his mentor, Collin Winter.
Line 15: Line 22:
* Last year there was a project to add confidence rankings to 2to3 changes. People could configure them to a certain level and deal with low confidence refactoring manually (or interactively). For some reason, the project was never finished. If you want to find more out about that, I suggest you contact [[http://isnomore.net/2to3|the student]] or his mentor, Collin Winter.

* Some people have expressed an interest in seeing a 3to2 tool which would make 3.x code valid for ~2.5. This is in the nonexistent stage, so you'd have to start writing fixers from scratch.
 * Some people have expressed an interest in seeing a 3to2 tool which would make 3.x code valid for ~2.5. Work is in progress, see [[3to2]]

2to3 is a tool that automatically translates 2.x code to 3.x code.

Description

Overview: Fun with 2to3 by Benjamin Peterson

Code

The code is located at http://svn.python.org/view/sandbox/trunk/2to3. At the moment, it is principally maintained by BenjaminPeterson. Since Python 2.6, it has been included in the standard library. http://docs.python.org/library/2to3.html

Ideas

  • Some people have expressed interest in adding directives in the source to 2to3. So you could write:
     # 2to3: strings-are-bytes
     x = "hi"
     # 2to3: end
    and that would get translated to

    x = b"hi"

  • Last year there was a project to add confidence rankings to 2to3 changes. People could configure them to a certain level and deal with low confidence refactoring manually (or interactively). For some reason, the project was never finished. If you want to find more out about that, I suggest you contact the student or his mentor, Collin Winter.

  • Some people have expressed an interest in seeing a 3to2 tool which would make 3.x code valid for ~2.5. Work is in progress, see 3to2

2to3 (last edited 2011-03-25 09:14:31 by techtonik)

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