Loading topic
match statement with a few case blocks. It covers the simplest kind of pattern: the literal pattern.2 min readmatch statement with literal case blocks, as in the earlier chapters. Here you learn the two patterns that match anything: the capture pattern and the wildcard.2 min readmatch and case work, and that you can write literal patterns and the _ wildcard. It also assumes Python 3.10 or later.2 min readmatch and case syntax, literal patterns, capture patterns, and * unpacking in assignments.2 min readmatch, case, literal patterns, and capture patterns work. It also assumes you can read basic dictionary code. Here you will see how mapping patterns match dictionaries, which is common when you handle JSON-like data.2 min read_ wildcard, and sequence and class patterns from earlier chapters. A pattern checks the shape of a value. It cannot express every condition, such as "the number is positive" or "the two coordinates are equal". A guar3 min read|), sequence and mapping patterns, and class patterns.2 min readenum.Enum in Python 3.10 or later. It covers how to compare a subject against a named constant inside a case.2 min readPoint(x=0, y=0). It also assumes you know how to define a dataclass. You need Python 3.10 or later.2 min read