[Python-ideas] Smoothing transition to Python 3

Nick Coghlan ncoghlan at gmail.com
Thu Jun 9 18:20:41 EDT 2016


On 8 June 2016 at 00:34, Pavol Lisy <pavol.lisy at gmail.com> wrote:
> 2016-06-05 7:14 GMT+02:00, Nick Coghlan <ncoghlan at gmail.com>:
>
>> Red Hat's Python maintenance team are working on a more explicitly
>> minimalistic porting guide based on their experiences porting Fedora
>> components, sometimes in the context of upstream projects that are more
>> interested in keeping Python 2.4 support than they are in Python 3:
>> http://portingguide.readthedocs.io/en/latest/
>
> do you have some drafts how to write (new) code supporting python from
> 2.4 - 2.7 with intention to port it to python3 in future?

Unfortunately, the only practical solution we've found for that case
is to fork the code base until the maintainers of the original project
are willing to raise the minimum version requirement to Python 2.6:
http://portingguide.readthedocs.io/en/latest/process.html#drop-python-2-5-and-lower

While it's theoretically possible to support 2.4+ and 3.x in the same
code base, it's painful in practice due to the lack of the forward
compatibility features added in Python 2.6 (such as the Python 3 style
syntax for name binding in except clauses)

For applications (rather than libraries), an alternate recommendation
is to bundle a Python 2.7 runtime on platforms where the system Python
is ancient, but whether or not that's a suitable solution will depend
a great deal on the specifics of the application.

My own view is that it doesn't make sense for *new* software (or new
versions of existing software) being written in 2016 to support a
version of Python that has been end-of-life for more than 7 years
(last release December 2008, first release November 2004), just to
allow folks to continue avoiding upgrading a base operating system
that is itself now two major releases behind (assuming your interest
in Python 2.4 support is driven by RHEL/CentOS 5 users).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list