Python 2 or 3?

The Python programming language is almost finished with a long-term transition from version 2 to version 3. New programmers often have questions about which version they should learn. It can be confusing to hear that Python 3, which was originally released in 2008, is still not the default installation on some operating systems such as macOS. However, that situation is rapidly changing as the final version 2 release, Python 2.7, is approaching its end-of-life that is definitively scheduled for January 1, 2020.

The simple answer right now is: learn Python 3, specifically the latest version which as of May 2018 is Python 3.6.5. If for some reason you absolutely have to learn Python 2, for example because your employer is working on a bunch of legacy code, you will be able to transfer the majority of your knowledge from Python 2 right into Python 3. Likewise, you will still be able to read and write Python 2 code if you start with Python 3.

There are enough great resources out there that will teach you to code in version 3 without any prior version 2 experience. Python 3 is the future and you will not regret starting with the latest version of the programming language.

One caveat to the recommendation to go full-on Python 3. If you are interested in DevOps-type work with configuration management tools such as Fabric or Ansible, then you may have to sometimes use both Python 2 and 3 because parts of these libraries are lagging in full Python 3 support.

Visualizations and Projects

Since upgrading from Python 2 to 3 has been such a huge undertaking within the community, many projects have sprung up to make the transition easier.

  • six is a 2/3 compatibility library that is a dependency for many popular Python projects to make it easier to support both Python 2 and 3 at the same time.

  • Python 3 Readiness is a visualization of which most popular 360 libraries (by downloads) are ready to be used with Python 3.

  • The Python clock counts down the time until Python 2.x is no longer maintained. While Python 2's retirement may still seem a long time away, it can take a lot of time and effort to migrate existing application to the modified syntax in 3.x.

Porting to Python 3 resources

Moving an existing codebase to Python 3 from 2 can be a daunting task, These resources were created by fellow developers who've previously gone through the process and have advice for making it less painful.

Python 2 to 3 resources

The following resources will give you more context on how the community feels the transition from Python 2 to 3 is going, as well as why you should upgrade as soon as possible.

What's next now that you know about Python versions?

What editor should I use to code my Python app?

I want to learn how to code a Python web application using a framework.

Show me a list of the best Python learning resources.

Sign up for a monthly email with Full Stack Python tutorials. No spam ever.


Matt Makai 2012-2018