what is the mechanism by which the following str
to Enum
equality comparison works?
from enum import Enum
class SE(str, Enum):
a = 'this'
b = 'works'
assert SE.a == 'this', "i can't believe that worked" # passes
whereas the following fails:
class E(Enum):
a = 'this'
b = 'does not'
assert E.a == 'this', "i'm not surprised that didn't" # raises
the weird thing is that str(SE.a) == 'SE.a'
, so i can't figure out how SE.a == 'this'
works under the hood.
thanks.
to be clear: this is python 3.6