GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Wiki
  • PSF Wiki
  • Jython Wiki
  • Python Wiki
  • Python 3 Migration

This view

  • Original page
  • New address

GeezerVison is showing wiki.python.org — 3to2

View as Markdown

3to2¶

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

3to2 is a project to convert cleaner 3.x code to 2.x.

3to2 started as a project idea to reuse the 2to3/lib2to3 codebase for converting 3.x code to 2.x. This creates a new package, ‘refactor’, which supports lib2to3 and (non-existent) lib3to2.

The following goals were targeted at the US PyCon 2009 sprint of Python Core:

  • retain lib2to3 API since it is in use (perhaps deprecate it later)

  • build a base package ‘refactor’ and port lib2to3 to it

  • package refactor with a 3to2 script

  • tackle high-priority conversions

The discussions at the sprint pointed to a handful of essential conversions to use as starting goals of 3to2:

  • from __future__ import * (2.6)

  • convert str or bytes to u'' or b'', respectively

  • convert print functions (2.5 and earlier)

  • convert exceptions (2.5 and earlier)

How far back into 2.x should 3to2 go?

Conversions from 3.x to 2.4 and earlier have a lot more work to do than those of 3.x to 2.6 and later. :-) During the sprint, we approached tackling major conversion items (see short list above) for 3.x to 2.6, then 2.5, then 2.4, …

During the Google Summer of Code 2009, Joe Amenta wrote a more-or-less complete lib3to2. It is hosted on bitbucket and has a PyPI page.

Previous
2to3
Next
5 Years of Python 3
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.