User Tools

Site Tools


python_3_versus_2

Python 3 Versus 2

Python 3 Versus Python 2

“The Python community is currently undergoing a transition from Python version 2 to Python version 3. As the major version number change implies, there are many incompatibilities between Python 2 and 3, and not just in the language. Quite a few of the Python standard library modules have been renamed or otherwise reorganized in Python 3.”

“The Python development community recognized that those Python incompatibilities would require an extended transition period, while the Python ecosystem of Python libraries and Python tools was updated to work with Python 3. Although many projects still rely on Python 2, it is only receiving Python security updates and is scheduled to be completely Python deprecated by 2020. All Python new-feature work is happening in the Python 3 releases.”

“It can be challenging, though not impossible, to write Python programs that work with both versions. Doing so often requires examining the version of Python under which a Python program is running and using different Python module names for Python imports or different Python arguments to Python classes or Python functions. A variety of Python tools, available outside of the Python standard library, can simplify this process. To keep the Python examples in this book as concise as possible, while still relying only on the Python standard library, they are focused on Python 3. All of the examples have been Python tested under Python 3.5 (the Python current release of the 3.x series at the time they were written), and may not work with Python 2 without modification. For examples designed to work with Python 2, refer to the Python 2 edition of the book, called The Python Standard Library by Example.”

“In an effort to maintain clear and concise descriptions for each example, the differences between Python 2 and 3 are not highlighted in each chapter. The Python Porting Notes appendix summarizes some of the biggest differences between these versions, and is organized to be useful as an aid when porting from Python 2 to 3.”

Fair Use Source: B072QZZDV7

python_3_versus_2.txt · Last modified: 2024/04/28 03:23 (external edit)