[docs] [issue19040] Problems with overriding Enum.__new__
Ethan Furman
report at bugs.python.org
Mon Sep 23 06:04:07 CEST 2013
Ethan Furman added the comment:
Yup, just trying to add some explanation on how it currently works.
Drekin, I'm sure you've already figured this out, but for those who may read this in the future: what you need is a helper function:
def OptionalEnum(value):
"could also be OptionalEnum(enum, value)"
try:
return SomeEnum(value) # or return enum(value)
except ValueError:
return value
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19040>
_______________________________________
More information about the docs
mailing list