So, what's the real story on Python 2 vs Python 3?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Dec 27 12:34:26 CET 2013


Chris Angelico wrote:

> However, I do broadly agree. For controlled environments, you should
> be able to slide from 3.1 to 3.2 to 3.3 to 3.4 on whatever schedule
> you choose, and happily drop support for the older versions. But in
> less controlled environments, that's a bit harder.
> 
> Probably within the next 5 years, it'll become reasonably plausible to
> support nothing older than 2.6, 

It's already reasonable to support nothing older than 2.6, or 2.7 for that
matter.

The *first* question you have to ask is, which third-party libraries do I
rely on? Those libraries will set the minimum system requirement. Beyond
that, you have total freedom to support as many or as few versions as you
like. Ask yourself:

- Which operating systems do I intend to support?

If the answer is "Windows only", you pretty much can pick whichever version
of Python you like, since all versions of Python are equally difficult (or
easy) to install on Windows. Likewise for Mac.

If the answer includes Linux or Unix, then the next question to ask is:

- Shall I support only the OS-provided version(s) of Python?

If so, then you need to work out which version(s) of Python are common to
all the OSes you intend to support. E.g. there are currently supported
versions of Centos and RHEL that provide Python 2.4. If you intend to
support those versions of Centos and RHEL, then you need to support Python
2.4. If you are prepared to drop support for such systems, then you can
drop support for 2.4 and move on to 2.5 or 2.6. It depends on how much
extra effort you wish to go to in order to support what percentage of your
users. Personally, I find it very annoying when vendors expect you to
upgrade perfectly adequate, still supported systems, and so I try to target
2.4+ when I can. (Also, I am still running a Centos system with 2.4, so I'm
scratching my own itch.)

On the other hand, I once tried to target Python 2.3+. That decision lasted
about two days. The amount of functionality missing from 2.3 compared to
2.4 makes it too painful.

Alternatively, if you don't care about the OS-provided Python (perhaps
you're providing your own, or you expect your users to install from
source), then I think it is acceptable to target 2.7 and 3.3 or better
(e.g. drop support for 3.1 and 3.2). 3.0 is not supported at all -- it was
a buggy release and was quickly dropped for 3.1. If you're not constrained
by "yum python3" or "apt-get python3", then 3.3 is probably the version you
should aim for.


-- 
Steven




More information about the Python-list mailing list