One enum class can inherit from other enum class only if the parent enumeration does not define any members.
enumSubclass.py
from enum import Enum
class Test(Enum):
def describe(self):
return self.name, self.value
class Test1(Test):
A = 1
B = 1
C = 23
print(Test1.A.describe())
Output
('A', 1)
No comments:
Post a Comment