Python 2 has officially reached its end of life. The Python programming language team just announced Python 2.7.18, the last release of Python 2. Going forward, Python 2 will no longer receive updates, bug reports, fixes or changes. 

The Python Software Foundation recommends those using Python 2 switch to Python 3 as soon as possible. Python 3 introduces new and improved capabilities that are not backwards compatible. Version 3 has been under active development since 2008. The latest version of Python 3 was version 3.8.2, which was a second maintenance release for Python 3.8. The team is currently working on Python 3.9, which is available as an early developer preview as of this month. 

To learn more about the changes between Python 2 and Python 3, and how to successfully move to Python 3, SD Times talked to Jeff Rouse, vice president of product at ActiveState. Below is an edited version of the conversation. The full interview can be found on the SD Times weekly podcast: “What the Dev?” 

SD Times: What does end of life for Python 2 mean for organizations?
Rouse: When Python 3 was introduced, Guido van Rossum and the core team decided that there were significant changes they wanted to make to the language that meant they were going to break backwards compatibility, and that is a very difficult call to make when you are designing a language. Design decisions you make a decade or two ago may not hold up in the light of new technology or where you want to take the language so ultimately with the introduction of Python 3, the community and core language maintainers spent the better part of a decade getting people to move off of Python 2 and onto Python 3 so that all the maintainers and everyone in the Python community that are supporting both versions can finally finish.

What the end of life means for Python 2.7 is there will be longer be any bug fixes, no improvements and probably most importantly no security updates into that language. That includes most of the community packages.

How long do organizations have to make the move to Python 3? 
Realistically, they should have already been thinking about this. It has been well advertised for quite a period of time. The initial thoughts were that by around 2010 everyone [would] start moving. 2014 was going to be the deadline, and then it was extended to 2020. 

Organizations should have already been thinking about it, and if they haven’t been or are new to it, that is fine. They can actually make use of all the content, applications and items available to help with the transition moving from Python 2 to Python 3. There are a series of steps you want to go through to evaluate how much it is going to take to move from Python 2 to Python 3 and each case is really different. 

With the last release of Python 2.7, do you think organizations feel pressure to finally make the leap and move forward?
Yes, and we have been seeing this a lot at ActiveState. We support both Python 2 and Python 3, and we’ve had a lot of new customers come to us and say ‘Hey, I am still on Python 2. Can you help us out?’ or ‘Can you give us a little more [time] until we are ready to get to Python 3?’

For organizations that have really large codebases, it is non-trivial to make the change. Even though this is not a rewrite to move from Python 2 to Python 3, it is significant enough that you need to comb through the codebase in a pretty painstaking way in order to make sure you have everything moved over. Then, by the same token, you have all these dependent packages that your codebase relies on, so you also have to take that into account. 

There can be some upgrade pains there as well so organizations should be planning immediately to do this. Recognizing that security vulnerabilities and bugs do crop up over time and depending upon their risk profile that could be something they should be very concerned about right now.

If they plan on maintaining their application moving forward, and they want to take advantage of any of the new technologies, take advantage of obviously having maintained security updates and bug fixes, they really have to move to Python 3. 

What are the differences you are going to see between Python 2 and Python 3?
What they have done [with Python 3] is really tightened up the syntax. One of the core philosophies of Python is to have just one way to do something and to do it very well. One of the great advantages of Python is that it is a very readable language, and it is so easy to work with that the language designers really decided they wanted to continue to improve upon that.

There is only one way to do iterators for instance, or there are not multiple ways to do ranges. So there are a lot of syntactic things that I think developers will benefit from, and it keeps things a little simpler. The performance of Python 3 continues to improve. The standard library has tons of improvements in it. It handles asynchronous functions in a much stronger fashion, and overall, all the efforts to continue to advance the language. All of that effort is going into Python 3 so that is really where you want to be.

Since there are so many considerations in the migration process, how can organizations successfully make the move? 
The first thing to do is to figure out what the risk profile is for your application and the utility. Then you know how much you want to invest and how important it is to do it sooner rather than later. The number one thing is to really start with excellent test coverage of your Python 2 app because it is going to be vital that as you move to Python 3, your test continues to show that the functionality hasn’t been broken in any way. 

My own personal opinion is if you are not on the latest Python 2.7, maybe you are on 2.6 or an earlier version of 2.7, it probably makes the most sense to ensure that everything works well right up to the final version. Then you can actually run source code translators…which gives you the results of your Python 2 translated to Python 3. From there, it will point out anything you need to manually fix up.

Along the way you are going to run into dependencies in your code with the various packages you are using. You may need to move to a different version of the same package. 

How do you see Python continuing to be used in the future and how is Python 3 going to play a role?
Python 3 is obviously the engine behind data science these days and in a lot of ways data science has coalesced around Python.

All the world-class data science is being done in Python. I don’t see that changing any time soon.  

When we talk about Python 2, there was a fair amount of data science being done in Python 2 as well but most of the major packages, for instance TensorFlow and others, have stopped supporting Python 2 at pretty early revisions so you are not really looking at wanting to do real data science, you can do a lot of data analysis in Python 2, but to really do hardcore data science, machine learning, you really want to be on Python 3.