[Python-Dev] lib3to2 in the 3.2 standard library?

"Martin v. Löwis" martin at v.loewis.de
Sun Feb 21 19:39:16 CET 2010


Joe Amenta wrote:
> Hey folks,
> 
> I'm going to write a PEP for inclusion of lib3to2 in the standard
> library for 3.2 and above.  Before do, though, do people have any quick
> thoughts about it?

I do: it seems too early to me. Before it is added, I'd like a see a
significant success story of its use.

When lib2to3 was added, both Guido and Benjamin were also concerned that
it is too early, and that 2to3 would change over time, so somehow
freezing the API was undesirable. I personally felt more comfortable: I
had ported a large project myself (Django), so I knew what little API I
used could actually help porting, and also that the set of fixers
implemented was useful (although the initial port had to made quite some
work-arounds for missing and incorrect fixers which aren't need today
anymore).

So find somebody to write a large project in Python 3, and then have
them backport it with 3to2 :-) Seriously, find somebody who ports a
large Python 2 project (e.g. with 2to3) in a burn-your-bridges fashion,
and then uses 3to2 to provide 2.x releases.

In addition, I recall talk (again from Guido and Benjamin, and perhaps
also Collin) that they would prefer all of this to be rewritten as a
general rewriting library, where 2to3 and 3to2 would just be specific
sets of transformations. If that is still the case, I think such a PEP
should address that (and the code should actually be refactored

> My inclination is to get it stabilized beforehand (perhaps during
> another GSoC) by fleshing out the fixer that warns about
> backwards-incompatible features in Python 3 and by finishing up the
> fix_imports2 fixer, probably involving a rewrite.

I think stabilization must require applications. So any further
development should focus on that. In my experience, this means that
you'll have to do the porting yourself, and then offer patches. Approach
some package author(s) whether they would be interested in using 3to2 if
you did the work for them, and then pick one such project as the litmus
test. My expectation is that you'll find a need for additional changes
in doing so.

Regards,
Martin


More information about the Python-Dev mailing list