Changes by Ethan Furman et...@stoneleaf.us:
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19040
___
Ethan Furman added the comment:
Doc patch is in #19011. I'll close this one when that one is closed.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19040
___
Drekin added the comment:
Yes, I've done it similarily using a class method. Thank you for help.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19040
___
Eli Bendersky added the comment:
On Sun, Sep 22, 2013 at 9:04 PM, Ethan Furman rep...@bugs.python.orgwrote:
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
Ethan Furman added the comment:
How about this note after the AutoNumber example?
.. note::
The :meth:`__new__` method, if defined, is used during creation of the Enum
members; it is then replaced by Enum's :meth:`__new__` which is used after
class creation for lookup of existing
Eli Bendersky added the comment:
LGTM, Ethan. You know how I feel about customization in general ;-) We should
give Enum a term or two in the stdlib to learn how it's being used and abused -
we can always *add* customization in the future.
--
___
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
New submission from Drekin:
I tried to implement an Enum variant OptionalEnum such that OptionalEnum(value)
leaves value alone and returnes it (if there is no corresponding enum member)
rather than raising ValueError. My use case is following: I'm trying to parse
some keyboard layout related
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19040
___
___
Python-bugs-list