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 | edit source]- W:History of Python#Version 3, en.wikipedia.org
- What’s New In Python 3.0, docs.python.org
- 28.11. __future__ — Future statement definitions, docs.python.org
- Porting Python 2 Code to Python 3, docs.python.org
- Cheat Sheet: Writing Python 2-3 compatible code, python-future.org
- Should I use Python 2 or Python 3 for my development activity?, wiki.python.org
- Python3.0, wiki.python.org
- Python 3 Readiness, pyreadiness.org
- PEP 373 -- Python 2.7 Release Schedule, legacy.python.org
- Python Developers Survey 2018 Results, jetbrains.com (conducted with Python Software Foundation)
- How we rolled out one of the largest Python 3 migrations ever, 2018, blogs.dropbox.com