[Python-Dev] Proposal for new 2to23 tool

Collin Winter collinw at gmail.com
Mon Nov 12 19:48:54 CET 2007


On Nov 12, 2007 12:50 AM, Graham Horler <graham.horler at gmail.com> wrote:
> On 12 Nov 2007, 03:24:34, Jan Claeys wrote:
> >
> > Op zondag 11-11-2007 om 17:19 uur [tijdzone -0800], schreef Brett
> > Cannon:
> > > On Nov 11, 2007 4:00 PM, Graham Horler <graham.horler at gmail.com> wrote:
> > > > I have been developing in Python since 1.5, and now have to support 2.1
> > > > as a minimum version.  I do like to keep my code runnable on newer
> > > > versions however, and am considering the feasability of forward
> > > > compatibility with Python 3.0.
> > > >
> > > > I also notice the Leo[1] project could use some assistance with forward
> > > > compatibility.
> > > >
> > > > So I was wondering if anyone else had a need for a 2to23.py tool to help
> > > > make code compatible with 3.0 but not break it for 2.x.
> > >
> > > What exactly are you proposing?  We already have 2to3
> > > (http://svn.python.org/view/sandbox/trunk/2to3/) for source-to-source
> > > translation from 2.x to 3.0.
> >
> > Graham wants to convert his code such that it works on both Python 2.x
> > (probably even early versions of it?) & Python 3.x.  Not 2 instances of
> > code, but one source that works on both 2.x and 3.x...
>
> Absolutely

I don't believe that's possible. There are enough key differences
between the two that having the same body of code work in both 2.x and
3.x would require an extensive, complicated runtime support system
that no-one has all(the ability, the time, the motivation) to
implement. And of course, even if you had such a system, the generated
code wouldn't look anything like well-formed Python and would be a
maintenance nightmare.

Collin Winter


More information about the Python-Dev mailing list