Python Versions¶
Important (to me) changes by version:
3.11¶
SPEED!
tomllib (read-only)
PEP 657: Fine-grained error locations in tracebacks
PEP 594: Many legacy standard library modules have been deprecated and will be removed in Python 3.13
3.10¶
match
pattern matching (which I have not yet looked at)parenthesized context managers (for formatting ease, no semantic difference)
Deprecate distutils module.
3.9¶
dict union operator
string methods to remove prefixes and suffixes.
zoneinfo
module
3.8¶
walrus operator (“:=”)
Positional-only parameters: “new function parameter syntax / to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments. “ -
def f(a, b, /, c, d, *, e, f):
means thata
andb
can only be passed by position and not by keyword.
3.7¶
context vars Context variables are conceptually similar to thread-local variables. Unlike TLS, context variables support asynchronous code correctly.
3.6¶
asyncio
module is no longer provisionalsecrets module provide an obvious way to reliably generate cryptographically strong pseudo-random values suitable for managing secrets, such as account authentication, tokens, and similar.
3.5¶
new
typing
modulenew os.scandir() function
new subprocess.run() function
3.4¶
new enum module
new pathlib module (provisional)
new ensurepip module
provisional asyncio module
3.3¶
The u’unicode’ syntax is accepted again for str objects.
new venv module and pyvenv script
3.2¶
new argparse module
major redesign of how bytecode is cached in files
PYTHONWARNINGS <https://docs.python.org/3/using/cmdline.html#envvar-PYTHONWARNINGS> env var