Welcome to getpython3.com - this site aims to be a resource for Python 3 for developers. This includes guides, videos, tutorials and other resources to help you and your team achieve a successful Python 3 port of your application, library, framework or tool. It also covers Python Software Foundation financial grants for porting to Python 3.
What is Python 3?
Although most Python code is currently written for Python 2.x, Python 3.x is the present and future of the language.
Python 2.7.6 was released in November 2013. The 2.x branch will have no further major releases, though the 2.7 end-of-life release will have an extended period of bug and security fixes.
Python 3.x continues to be actively developed. The most recent release is Python 3.3, released in November 2013.
Guido van Rossum (the original creator of the Python language), together with other python-core developers, decided to use Python 3.x to clean up the Python language. Python 2.x releases were always careful to preserve backwards compatibility with older versions, but Python 3.0 was a clean-up that didn't have to carry old features.
The major differences are:
- Better Unicode support
Unicode is now woven into the language, with all text strings being made Unicode by default.
- Easier for newcomers
Dividing integers always returns an accurate result. Integers can handle any size, no longer limited to the machine's word size. Comparison operators are simpler, and comparing different types is now an error. Catching exceptions in the
except:statement is clearer.
- Removed old features and complications
All classes are now new-style.
range()and various dictionary methods return a memory-efficient iterable and not a list. List comprehensions no longer leak the value for their looping variable.
The What's New in Python 3.0 document provides a good overview of the major language changes between 2.7 and 3.x, and discusses likely sources of incompatibility with existing Python 2.x code.
The most current version of Python 3 is 3.3.3 - here's a list of new things added:
yield fromexpression for delegating to a generator (PEP 380)
- new library modules for LZMA compression, mock objects for unit tests, and representing IP addresses
- the decimal type has been re-implemented in C, making it much faster
- PEP 393, Flexible String Representation, which reduces memory usage and removes the distinction between narrow and wide builds of Python.
- PEP 397, a Windows® launcher for *.py files.
- PEP 405, Python Virtual Environments
- PEP 3118, new implementation of the memoryview type.
- PEP 3151, reworked hierarchy of OS and I/O exceptions
importstatement is now built atop the importlib module
- for easier porting to Python 3, the
u''syntax is now accepted again
- security fix: hash randomization is now enabled by default.
You can see details on what's changed by looking at the "What's New in 3.3" document, as well as the earlier What's New articles, and the change log. Builds are available for all major platforms, and OS X users can use homebrew via "brew install python3"
Learn Python 3
Here are some resources for learning Python 3:
- Python's documentation includes a tutorial.
- We've mirrored Mark Pilgrim's excellent book Dive into Python 3 at getpython3.com/diveintopython3/.
There is a wealth of information out there about Python 3 and porting to it. There is an entire mailing list (python-porting) dedicated to helping people port things to Python 3 - developers experienced in porting should join up, and there is already a good team there to help support you.
Python 3 Overviews
- What's New in Python 3.0 (February 2009)
- Linux Journal: Python Python Python (aka Python 3) (August 2009)
Guides, cheat sheets and tutorials:
- HOWTO: Porting Python 2 Code to 3
- HOWTO: Porting C Extension Modules to Python 3
- Cheatsheet for moving from Python 2 to Python 3 (pdf)
- Nick Coghlan: Python 3 and ASCII Compatible Binary Protocols (2014)
- Nick Coghlan: Processing Text Files in Python 3 (2014)
- David Beazley: Mastering Python 3 I/O
- David Beazley: Python 3 Metaprogramming
- Python 3 Porting Guide
- Wiki: Python2orPython3
Posts & links from the community:
- Lessons Learned Porting Dateutil to Python 3 (2011)
- zzzeek's Guide to Python 3 Porting (2011)
- David Beazley: Porting Py65 (and my Superboard) to Python 3 (2011)
- Barry Warsaw: Lessons in porting to Python 3 (2011)
- Porting to Python 3 — A Guide (2010)
- Michael Foord: Porting Mock to Python 3 (2010)
- Alexandre Vassalotti: Porting your code to Python 3 (2009)
Many libraries and packages are available for use with Python 3. You can see a semi-complete list of all Python 3 supporting packages on the Python Package Index. A different site offers a regularly updated list of the most popular packages.
The following libraries/projects and frameworks are available for Python 3. Some of these represent entire frameworks, while others are major dependencies for other projects and tools:
- Web frameworks: Django, Pyramid, Webob.
- Numeric programming: NumPy, SciPy, Pandas.
- virtualenv (included in Python 3.3)
- Mako Templates
Financial support for porting
Python 3 is the future of the Python language, and the Python Software Foundation (PSF) strongly believes in supporting the porting effort.
For example, the PSF issued developer grants to port projects such as the email package, PyOpenSSL, and WebOb. It has also provided grants for other general Python development work, such as to Brett Cannon for completely rewriting the Python developer's guide.
The Python Software Foundation is here for not just CPython, or python-core, or Python-the-language. It is here for Python - the community, its efforts, its developers, designers and people.