Skip to content

Latest commit

 

History

History

python

Python Summary/Quickref

When using pip with a system (OS-packaged) Python, ensure that the python-dev or python3-dev (Debian) package is installed or some packages may not build. (The typical error message will include something about not being able to find <Python.h>.)

Glossary

  • dunder: Double underline, as in __name__.

Major Changes in New Versions

See also python-version-cheat-sheet and offical changelog.

  • 3.3: yield from (PEP380)
  • 3.4: pathlib (PEP 428)
  • 3.5: Additional unpacking generalisations (PEP 448). Type annotations excepting variables (PEP 484).
  • 3.6: f-strings (PEP 498, for ≥3.12 PEP 701). Underscores in numeric literals, e.g. 1_000 (PEP 515). Type annotations for variables (PEP 526).
  • 3.7: Guaranteed sort order of dicts. Data classes (PEP 557). breakpoint() (PEP 553). Postponed eval of annotations (PEP 563).
  • 3.8: Walrus operator := (PEP 572)
  • 3.9: Built-in generic types; annotate w/list[int] instead of from typing import List (PEP 585).
  • 3.10: Structural pattern matchin (PEP 622). Union types as X | Y (PEP 604).
  • 3.11: Exception groups, except* (PEP 654). Standard library tomlib for parsing TOML (PEP 680).