PyCon Israel 2025

Beyond constants: Mastering Python enums
09-09, 11:30–11:50 (Asia/Jerusalem), Hall 1
Language: עברית

Explore advanced enum usage in Python: define methods, attach metadata, and create enums dynamically. Learn the benefits and pitfalls of the enum singleton to write more expressive and maintainable code.


While working on the open-source hdate library (which I maintain) and on internal tools at Intel, I came across some lesser-known but powerful uses of Python enums.
From attaching extra data and methods to make code more expressive, to dynamically generating enums from configuration files, these patterns can add clarity to your code if used with care.
In this talk, I’ll share these techniques, their advantages, and the subtle pitfalls to watch out for when using a singleton data structure.


Expected experience level of participants

Basic

Target audience

Developers

Tsvi Mostovicz is a senior verification engineer who enjoys writing Python that's both practical and expressive. He maintains the Jewish calendar integration in Home Assistant, provides syntax support for the Specman language, and enjoys exploring Python features that make code cleaner and more maintainable.