Python Programming/Python 2 vs. Python 3

Python 3 was created incompatible with Python 2. Support for Python 2.7 ended in 2020.

One noticeable difference is that in Python 3, print is not a statement but rather a function, and therefore, invoking it requires placing brackets around its arguments. Differences with deeper impact include making all strings Unicode and introducing a bytes type, making all integers big integers, letting slash (/) denote a true division rather than per default integer division, etc.; for a compact overview, see Python wiki.

Python 2 code can be made ready for a switch to Python 3 by importing features from __future__ module. For instance, from __future__ import print_function makes Python 2 behave as if it had Python 3 print function.

Python 3 was first released in 2008.

A list of Python packages ready for Python 3 is available from py3readiness.org.

A survey conducted in 2018 by JetBrains and Python Software Foundation suggests significant adoption of Python 3 among Python users.

External links edit