~/talk

Beyond constants: Mastering Python enums

Talkat PyCon Israel 2025 · on Tuesday, 2025-09-09· [python, compilers-and-language-design]
github:tsvi
slides:none on file

Built a Python port of HDate for Home Assistant that models Hebrew months as enums with methods to advance dates and lambdas for variable month lengths, showing how enums hold metadata and behave like classes. A separate Intel tool generates enums from a runtime config dictionary for dynamic enum generation, which gives automatic validation and better type hints. Practical failures: attaching mutable attributes (e.g., a language field) exposes the enum singleton bug so state leaks across uses, and tests become order-dependent; enums work but avoid per-user or runtime-changing state.

AI-written summary · about

  1. 0:00Introduction to Python enums
  2. 1:53Why use Python enums
  3. 4:23Python enums basics
  4. 7:47Advanced enum techniques
  5. 11:31Dynamic enums in practice
  6. 14:46When to avoid dynamic enums
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.