Enums in python - set by name and value
God I need to read documentation, all of it, including not-important sounding first sentences.
Previously: 220810-1201 Huggingface utils ExplicitEnum python bits showing me how to do str enuenums
.. you can set using both.
enum — Support for enumerations — Python 3.11.0 documentation:
- use call syntax to return members by value
- use index syntax to return members by name
class MyEnum(str,Enum):
IG2 = "val1"
IG3 = "val2"
MyEnum("val1") == MyEnum["IG3"]
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus