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 ethan.furman
Recipients Drekin, barry, docs@python, eli.bendersky, ethan.furman
Date 2013-09-23.04:04:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379909046.99.0.844905213611.issue19040@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-09-23 04:04:07ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky, docs@python, Drekin
2013-09-23 04:04:06ethan.furmansetmessageid: <1379909046.99.0.844905213611.issue19040@psf.upfronthosting.co.za>
2013-09-23 04:04:06ethan.furmanlinkissue19040 messages
2013-09-23 04:04:06ethan.furmancreate