Обложка канала

Библиотека Python разработчика

20835 @BookPython

Библиотека Python разработчика. Книги по программированию на Python.

Библиотека Python разработчика

3 года назад
Открыть в
Add additional attributes to enum members in Python

While grokking the source code of http.HTTPStatus module, I came across this technique to add additional attributes to the values of enum members. Now, to understand what do I mean by adding attributes, let's consider the following example: # src.py from __future__ import annotations from enum import Enum class …

Redowan's Reflections