Python 2 vs 3 – Time to Upgrade
Python is a programming language that’s popular with software engineers, data engineers and data scientists alike. The 2.x branch of Python (aka “Python 2”) was released way back in 2001, but you’d be surprised how many applications are still built with it. Though Python 3.x (aka “Python 3”) first hit the scene in 2008, Python 2 has continued to be maintained and updated. However, as of January 1, 2020 that will no longer be true.
What About My Existing Python Apps?
January 1, 2020 is the “end of life date” (EOL) of Python 2.x, which means that while your Python 2 applications will continue to function past that date, bug fixes, security patches and improvements to Python 2 will officially cease. In addition, many libraries that your application uses may no longer be fixed and improved.
The EOL date for Python 2 has already been pushed from 2015 to 2020, and with the new date on the horizon it’s unlikely to be pushed again. It’s time to get serious about planning an upgrade to any existing Python 2 code, especially if you’re concerned about security vulnerabilities.
What About Current and Future Development?
If you have current development ongoing in Python, ensure it’s done using Python 3.
Don’t assume this is the case! Check with your developers, or if you are a developer ensure your team has made the transition. It’s easy for teams to keep developing in Python 2 because that’s what they’ve always used. Even well-meaning IT teams have held back developers from updating because they lock down development machines and servers tightly. If that’s the case, a gentle reminder about the EOL date for Python 2 is usually enough to get things moving. Remember, this isn’t just about new features it’s also about bug fixes and patching future security vulnerabilities.
What’s the Difference Between Python 2 and Python 3?
To be honest, as a programmer the transition from Python 2 to Python 3 is pretty simple. Python.org created a guide to explain the technical differences, and while they refer to Python 3 as “the first ever intentionally backwards incompatible Python release”, the syntactical differences are quite minor.
If you’re a beginning Python programmer, you’ll likely just need to know that the print statement in Python 2 is instead a function is Python 3, along with a few other minor changes. Advanced developers will want to dive into the guide and learn about more detailed updates like how handing of binary data and Unicode changed from Python 2 to Python 3.
In addition, you’ll need to look into any libraries you previously used in Python 2 and check for Python 3 compatibility. Most popular ones support Python 3, but there are always libraries that were abandoned years ago. Now is the time to look into alternatives.
Why Should Data Professional Care?
As I mentioned in the introduction, Python isn’t just a language used by software engineers building applications and websites. It’s commonly used by data scientists and data engineers. In fact, it’s quite likely that your data pipelines and machine learning models are at least partially built in Python. By developing new work in, and have fully migrated existing code to, Python 3 you’re ensuring that you’ll be able to take advantage of future functionally as well as bug fixes and security patches. Don’t wait, the clock is ticking!
Don’t forget to sign up for the Data Liftoff mailing list to get more content and to stay up to date on the latest in data science and data engineering.