This page documents the most significant additions and changes in each version of Python starting with version 3.0. If I have omitted changes that you feel are significant, please let me know and I will add them.
Python 3.0 - December 3, 2008
-
Strings now use Unicode instead of ASCII.
-
The
printkeyword was replaced by theprintfunction. -
The
<>operator was removed. Use!=instead. -
Some functions and methods now return “views” (like an iterator) instead of a
listobject. -
The
longtype was renamed toint. -
Expressions like
1 / 2now return afloatinstead of anint. -
The
__cmp__method is no longer supported and thecmpfunction should not be used. -
The default encoding for source code is now UTF-8.
-
Non-ASCII letters are now allowed in identifiers.
-
The
StringIOmodule is now inio.StringIO. -
Annotations can be added to function arguments and to functions to describe their return value. The goal is to enable future tooling to use the annotations for purposes such as type checking and documentation generation.
-
The
nonlocalstatement was added to allow functions to access non-local, non-global values. -
Iterable unpacking was added. For example:
a, b *rest = data a, *rest, b = data *rest, a, b = data -
Support for tuple unpacking in parameter lists was removed.
-
List comprehension syntax changed slightly.
-
Dictionary comprehensions were added.
-
Support for
setliterals was added. For example,{'one', 'two', 'three'} -
Set comprehensions were added.
-
Exception catching syntax changed from
exception ErrorName, var_nameis nowexception ErrorName as var_name
Python 3.1 - June 27, 2009
- The
OrderedDictclass was added in thecollectionsmodule. - New features were added to
unittestincluding test skipping and new assert methods. - tile support was added to tkinter
- Support for a new syntax for nested
withstatements.
Python 3.2 - February 20, 2011
- The
concurrent.futuresmodule was added to support concurrent programming. - Additions were made to the
shutilmodule. - The
sysconfigmodule was added. - The
argparsecommand-line parsing module was added. - Improvements were made to the
pdbdebugger.
Python 3.3 - September 29, 2012
- The
unittest.mockmodule was added to support implementing mock objects used by tests. - The
venvcommand for managing virtual environments was added. - Support for generator delegation was added via
yield fromexpressions.
Python 3.4 - March 16, 2014
- The
asynciomodule was added. - The
enummodule was added. - The
pathlibmodule was added. - The
selectorsmodule was added. - The
statisticsmodule was added.
Python 3.5 - September 13, 2015
- The
typingmodule for type hints was added. - A new exception class,
RecursionError, was added. - Support for coroutines with
asyncandawaitwas added. - Support for the matrix multiplication operator
@was added. It not supported by built-in data types such as nested lists, but is supported by NumPy.
Python 3.6 - December 23, 2016
- Support for formatting string literals (a.k.a. f-strings)
with the syntax (
f'...') was added. - Support for underscores in numeric literals was added. Single underscores can be added anywhere inside a literal number for readability and they are ignored.
- Support for variable annotations was added.
- Support for async comprehensions was added.
- Support for async generators was added.
- The
secretsmodule was added.
Python 3.7 - June 27, 2018
- The
contextvarmodule was added. - The
dateclassesmodule was added. - The
breakpointfunction was added. - Preserving insertion order in
dictobjects was made official. - The
timemodule gained functions for nanosecond resolution.
Python 3.8 - October 14, 2019
- Support for the
:=“walrus operator” for assignments inside expressions was added. - Support for position-only parameters with
/syntax was added. - Support for the
=specifier was added to f-strings.
Python 3.9 - October 5, 2020
- The string methods
removeprefixandremovesuffixwere added. - Support for the union operators
|and|=for mergingdictobjects was added. - The ability to add generics type hinting in standard collections was added.
- Python code is now parsed by a new PEG parser.
- An IANA Time Zone Database was added in the
zoneinfomodule. - The
graphlibmodule was added, with support for topological sorting. - CPython will adopt an annual release cycle (like ECMAScript).