← All terms · Syntax
Match statement
Structural pattern matching (PEP 634, Python 3.10+). `match val: case Point(x, y): ...`. Matches on shape, not just value — closer to Rust/Scala match than C switch.
match cmd:
case ["go", direction]: walk(direction)Learn this interactively:
Open lesson iv-94 →Related — Syntax
f-stringAn f-prefixed string literal that lets you inline expressions: `f"x={x}"`. Intro…Walrus operator`:=` assigns inside an expression. Useful when you'd otherwise compute the same …Type hintsAnnotations that describe expected types: `def f(x: int) -> str:`. Not enforced …Truthy / falsyValues that act as True / False in `if` statements. Empty containers, `0`, `None…SlicingSubstring/sublist via `s[start:stop:step]`. Negative indices count from the end.