Perl Zero Day Security Threats
ActiveState has backported the zero day vulnerability patch & introduced EOL extended support for ongoing security fixes. Learn more.
Read MoreSince the Python 3 series was first released in 2008, the core team has consistently produced releases that have moved the language forward. If you work for an organization that has built their applications in Python 2.7 (or older), you know that the Python Software Foundation no longer supports or updates Python 2. While your applications may be working fine today, they will become more vulnerable over time as security issues are found. As a result, you should be evaluating whether it is time to migrate to Python 3.
In order to assist with the migration, many large organizations run Python 2.7 in parallel. Since you can safely install both ActivePython 2.7 and ActiveState Python 3 side-by-side on your computer, you can experiment with Python 3 while still using Python 2 for your current code.
Download ActiveState Python to help with your Python migration project. Python is available for Windows, Linux, and macOS.
Migrating to Python 3 is not a simple “push button” upgrade because Python 3 is not backward compatible with Python 2. You will have to make code-level changes. Also keep in mind that while most of the open source libraries you used to build your application on Python 2 have been ported to Python 3, they may not work in exactly the same way. Testing will be key.
Python 3 also offers a number of significant improvements over Python 2, including:
Python 3 also gives you function annotations and range memory objects which are significantly more memory efficient. Some of the code-level changes are highlighted below:
The print
statement has been replaced with a print()
function, with keyword arguments to replace most of the special syntax of the old print statement.
Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
Old: print >>sys.stderr, "fatal error"
New: print("fatal error", file=sys.stderr)
How Python handles text vs. data has changed considerably. All text is Unicode (represented by the str
type), all binary data (e.g. 8-bit strings, encoded Unicode) is held in the new bytes
type.
Python 3 supports function argument and return value annotations. Functions can declare keyword-only arguments. Extended iterable unpacking allows code like:
a, b, *rest = some_sequence
*rest, last = some_sequence
Other syntax changes:
d = {k: v for k, v in stuff} # dictionary comprehensions
s = {"peter", "paul", "mary"} # set literals
mode = 0o755 # octal literals
mask = 0b01001111 # binary literals
data = b"marker" # bytes literals
There are many more changes in Python 3. Resources for Python 3:
The currently suggested path for migrating from Python 2 to 3 is to:
For more information:
Developers worldwide rely on ActivePython’s completeness and ease-of-use, while corporate users protect their infrastructure and stay competitive with quality-assured ActivePython business solutions.
ActiveState has backported the zero day vulnerability patch & introduced EOL extended support for ongoing security fixes. Learn more.
Read MoreLearn how ActiveState generates runtimes to securely extend your Cloudera environment with the latest Data Science and Machine Learning tools.
Read MoreCode and Binary repositories are essential elements of a secure software supply chain, but used incorrectly they can be the weakest link.
Read More