Skip to content
← All tracks

Modern Syntax and Modernisation

Python

Structural pattern matching, f-string internals, PEP 695 syntax and the version-gated features worth adopting.

This track is written for Python, which isn't the mode you're browsing in.

0 / 12 solved · 6 articles
  1. 1. The old way → new way reference table Read
  2. 2. Where f-strings are the wrong answer Read
  3. 3. When `match` is better than `if/elif` — and when it isn't Read
  4. 4. PEP 758: `except A, B:` without parentheses Read
  5. 5. PEP 798: unpacking in comprehensions Read
  6. 6. PEP 810: explicit lazy imports Read
  7. 7. Not solved yet. PEP 686: UTF-8 by default, and the migration hazard
  8. 8. Not solved yet. The f-string format specification mini-language
  9. 9. Not solved yet. PEP 701: what f-strings can finally do in 3.12
  10. 10. Not solved yet. Self-documenting f-strings: f"{x=}"
  11. 11. Not solved yet. match/case fundamentals: literal, capture, wildcard
  12. 12. Not solved yet. Class patterns, __match_args__ and an expression simplifier
  13. 13. Not solved yet. Exhaustive matching with assert_never
  14. 14. Not solved yet. Guards, OR patterns, AS patterns and the binding rules
  15. 15. Not solved yet. Sequence and mapping patterns: the two rules everyone gets wrong
  16. 16. Not solved yet. Positional-only `/` and keyword-only `*`
  17. 17. Not solved yet. Template strings (t-strings) and interpolation safety
  18. 18. Not solved yet. The walrus operator, tastefully

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

Col is an Enum with R = 1. What do Col.R is Col(1) and Col.R == 1 give?

class Col(enum.Enum):
    R = 1

Col.R is Col(1)
Col.R == 1
Question 1 of 4