[Python-3000] Strategy for porting to 3.0?
Nick Coghlan
ncoghlan at gmail.com
Sun Mar 23 11:42:09 CET 2008
Tony Meyer wrote:
> Hi Skip!
>
> [Skip]
>>> After the next SpamBayes release I plan to branch the code and work on
>>> porting it to Python 3.0, mostly as an experiment in porting code from
>>> Python 2.x to 3.x whose results I can feed back to the larger Python
>>> community.
>
> Cool :)
>
>>> I'm curious about how best to approach the problem.
>
> It's a guess, but I think SpamBayes supporting Python 2.2 will cause
> issues with this. I'm sure that it'll be possible to create code that
> works (when 2to3'd) with Python 2.6 and Python 3.0 - maybe even 2.5 or
> 2.4 as well. However, having a single version (plus 2to3'd copy) that
> works with 2.2, 2.3, 2.4, 2.5, 2.6 and 3.0 seems to be asking for a
> lot.
Hmm, I wonder if a 2to3 fixer could be developed to drop dead portions
of version checks like "if sys.version_info < (2, 5):" since it knows
version_info will also be at least (3, 0) for the produced code.
It seems like that would be a fairly powerful means of including "2.x
only" code and have it automatically removed in the conversion to 3.0
(e.g. by using a condition like "if sys.version_info < (3, 0):" to mark
the 2.x specific code).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list