Python Versions =============== .. contents:: 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 `_ (":=") * `f-strings add "=" support `_ * `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 that ``a`` and ``b`` can **only** be passed by position and not by keyword. * `asyncio.run `_ 3.7 --- * `context vars `_ Context variables are conceptually similar to thread-local variables. Unlike TLS, context variables support asynchronous code correctly. * `Data classes `_ 3.6 --- * ``asyncio`` module is no longer provisional * `f-strings `_ * `underscores in numeric literals `_ * `secrets 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 --- * `can use multiple "*" and "**" unpacking operators `_ * new ``typing`` module * new `os.scandir() `_ function * new `subprocess.run() `_ function 3.4 --- * new `enum module `_ * new `pathlib module `_ (provisional) * new `ensurepip module `_ * provisional asyncio module 3.3 --- * `yield from expression `_ * The u'unicode' syntax is accepted again for str objects. * new `unittest.mock module `_ * new `venv module `_ and pyvenv script * `implicit namespace packages `_ 3.2 --- * new `argparse `_ module * `logging.config.dictConfig() `_ * major redesign of `how bytecode is cached in files `_ * `PYTHONWARNINGS ` env var * `functools.lru_cache() `_