This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients Drekin, barry, docs@python, eli.bendersky, ethan.furman
Date 2013-09-23.13:57:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAF-Rda9m2B5rQsJVp=m2cdjqUY44POks3OAq2NTuB1X8=eXQAg@mail.gmail.com>
In-reply-to <1379909046.99.0.844905213611.issue19040@psf.upfronthosting.co.za>
Content
On Sun, Sep 22, 2013 at 9:04 PM, Ethan Furman <report@bugs.python.org>wrote:

>
> 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
>

Hmm, looks suspiciously similar to _inienum_converter from socket.py ;-)
History
Date User Action Args
2013-09-23 13:57:27eli.benderskysetrecipients: + eli.bendersky, barry, docs@python, ethan.furman, Drekin
2013-09-23 13:57:27eli.benderskylinkissue19040 messages
2013-09-23 13:57:27eli.benderskycreate