Python Cheatsheet
NewPython 3 reference — comprehensions, decorators, error handling, and modern syntax.
Frequently Asked Questions
Does this cheatsheet assume a recent Python version?
Partly, yes. It has a dedicated “Modern Python (3.10+)” category for features like match/case, the | union type syntax, and other newer language features.
Does it cover dataclasses and mutable default pitfalls?
Yes. The OOP & Dataclasses section includes @dataclass, field(default_factory=...), and __post_init__, which are exactly the entries people usually need for that topic.
Why doesn't match/case work for me if I copy it straight from here?
Because structural pattern matching is only available in Python 3.10 and newer. The tool labels that section clearly, but it does not detect your interpreter version for you.
Are command-line tasks like virtual environments and pip included, or just code syntax?
They are included. The Tooling section has entries for creating a venv, installing packages, upgrading pip, and freezing requirements.
Is this interactive like a REPL or just a reference page?
It is just a searchable reference. You can filter, toggle short vs full syntax, and copy snippets, but the page does not execute Python.