Feb-13-2022, 01:45 AM
(This post was last modified: Feb-13-2022, 01:45 AM by stevendaprano.)
Thanks deanhystad, but my enums shouldn't be a string subclass.
I think I have found a solution thanks to this blog post.
I think I have found a solution thanks to this blog post.
from enum import Enum class MyEnum(Enum): MEMBER = ("Hello world", 1.5) def __new__(cls, value, extra): obj = object.__new__(cls) # Don't use super(), use object obj._value_ = value obj.extra = extra return obj