Why Python 3?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Apr 20 05:43:46 EDT 2014


On Fri, 18 Apr 2014 21:50:09 -0700, Ethan Furman wrote:

> Use Python 3 if you can.  The best reason not to is if you have some
> critical library that you absolutely need and it's not yet available on
> 3.  

That's good advice, but it isn't just applicable to Python 3, it applies 
to *any* critical library that does not support recent versions of 
Python. Suppose you have a library that only supports Python 2.2, 2.3 and 
2.4, and you cannot do without that library or reinvent it yourself. Then 
you would surely use Python 2.4. That shouldn't be seen as a rejection of 
all the versions from 2.5 onwards, but a painful and necessary decision 
due to the requirement to use that library.

In practice, most libraries that don't support 2.5 and better are more or 
less abandoned. But you might still choose to use an abandoned library 
because it works and you don't need to worry about security updates.

So really the advice comes down to:

- if you can, use the latest version of Python, which is 3.4;

- if you must, use the version of Python provided by your operating
  system, which could be anything from Python 2.3 to 3.3;

- if you have no choice except to use a library that only supports 
  version X, then use version X, no matter what X happens to be.


None of this should be controversial. It should be common sense.

(There are, of course, a few difficult questions relating to what counts 
as "must". You may weigh up the cost of doing without that annoyingly old 
library versus the benefit of using a more recent Python version, and 
decide that maybe you can do without it. Or not.)




-- 
Steven D'Aprano
http://import-that.dreamwidth.org/



More information about the Python-list mailing list