Message289191
class Label(Enum):
RedApple = 1
GreenApple = 2
@classmethod
def _missing_(cls, name):
for member in cls:
if member.name.lower() == name.lower():
return member
Currently, _missing_ is only called when using the functional API. In words:
Label('redapple') # works
Label.redapple # does not |
|
Date |
User |
Action |
Args |
2017-03-07 22:29:52 | ethan.furman | set | recipients:
+ ethan.furman, barry, eli.bendersky |
2017-03-07 22:29:52 | ethan.furman | set | messageid: <1488925792.17.0.971645599389.issue29752@psf.upfronthosting.co.za> |
2017-03-07 22:29:52 | ethan.furman | link | issue29752 messages |
2017-03-07 22:29:52 | ethan.furman | create | |
|