Why Python 3?

Ben Finney ben+python at benfinney.id.au
Sat Apr 19 07:05:41 EDT 2014


Anthony Papillion <papillion at gmail.com> writes:

> So I've been working with Python for a while and I'm starting to take
> on more and more serious projects with it. I've been reading a lot
> about Python 2 vs Python 3 and the community kind of seems split on
> which should be used.

The community is in transition; the direction is clear, but different
people have different situations.

> Some say 'Python 3 is the future, use it for everything now' and other
> say 'Python 3 is the future but you can't do everything in it now so
> use Python 2'.

Well, it's clear: Python 3 is uncontroversially the future :-) Also:
Python 3 is the only path which is currently being maintained as a
target for new code.

Python 2 is in bug-fix mode only, has been for years, will not be
supported indefinitely, and will never get new features.

Python 3 support is already excellent now, is getting better all the
time, and Python 2 is losing ground and will continue to do so.

> What is the general feel of /this/ community?

I'd advise: that's less important than the specific needs of what *you*
will be doing. If you can drop Python 2 for your specific project, do
so; if you can't yet, set yourself up such that you can drop Python 2 as
soon as feasible, and agitate for the blockers to be removed ASAP.

> I'm about to start a large scale Python project. Should it be done in
> 2 or 3? What are the benefits, aside from the 'it's the future'
> argument?

* Python 3 (unlike Python 2) gets Unicode right. This makes it almost
  unique among today's programming languages, and has become essential
  for 21st century programming.

  Any programs you begin today – in any programming language – can
  expect to be used with international text, and increasingly so as time
  goes on. Unicode is the only game in town for freely mixing all
  writing systems of the world. You need Unicode to be correct to the
  core of the language.

* Python 3 (unlike Python 2) comes with support for virtual Python
  environments, namespace packages, third-party package installation,
  and other improvements that make it much simpler to deploy complex
  projects (which you'll likely need sooner than you think with any new
  project).

* Python 3 (unlike Python 2) has more secure and efficient parallel and
  concurrent processing: multiprocessing, asynchronous processing,
  generator delegation, and “futures” all make it a more capable,
  reliable, and expressive language for distributed programming.

* Python 3 (unlike Python 2) has a better-kept house: its standard
  library, exception hierarchy, bytecode files and extension modules,
  and import mechanics, have all undergone consolidation and are more
  predictable and uniform across implementations.

There are <URL:https://docs.python.org/3/whatsnew/> many other benefits.
See <URL:https://wiki.python.org/moin/Python2orPython3> for a discussion
of how to determine whether it's yet time for you to go with Python 3.

In brief though, from that last document:

    Short version: Python 2.x is legacy, Python 3.x is the present and
    future of the language
    […]
    Which version you ought to use is mostly dependent on what you want
    to get done.

    If you can do exactly what you want with Python 3.x, great!

-- 
 \        “Spam will be a thing of the past in two years' time.” —Bill |
  `\                                                 Gates, 2004-01-24 |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list