I would like to use isinstance() method to identify class variable is it belongs to the given class.
I created an own Enum() base class to list class variables of subclasses. I did't detail body of source code, not important.
class Enum(object):
@classmethod
def keys(cls):
pass # Returns all names of class varables.
@classmethod
def values(cls):
pass # Returns all values of class varables
@classmethod
def items(cls):
pass # Returns all class variable and its value pairs.
class MyEnum(Enum):
MyConstantA = 0
MyConstantB = 1
>>>MyEnum.keys()
['MyConstantA', 'MyConstantB']
I would like to use this one:
>>>isinstance(MyEnum.MyConstantB, MyEnum)
True