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 barry, eli.bendersky, ethan.furman
Date 2017-03-07.22:29:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488925792.17.0.971645599389.issue29752@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-03-07 22:29:52ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky
2017-03-07 22:29:52ethan.furmansetmessageid: <1488925792.17.0.971645599389.issue29752@psf.upfronthosting.co.za>
2017-03-07 22:29:52ethan.furmanlinkissue29752 messages
2017-03-07 22:29:52ethan.furmancreate