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 JEphron, ethan.furman
Date 2021-06-10.15:33:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Since I like puzzles, here is a working LenientStrEnum:

    class LenientStrEnum(str, Enum):
        def __init__(self, *args):
            self._valid = True
        def _missing_(cls, value):
                f"[{cls.__name__}] encountered an unknown value!\n"
                f"Luckily I'm a LenientStrEnum, so I won't crash just yet.\n"
                f"You might want to add a new case though.\n"
                f"Value was: '{value}'"
            unknown = cls._member_type_.__new__(cls, value)
            unknown._valid = False
            unknown._name_ = value.upper()
            unknown._value_ = value
            cls._member_map_[value] = unknown
            return unknown
        def valid(self):
            return self._valid

`_member_map_` is not guaranteed, but is unlikely to change.
Date User Action Args
2021-06-10 15:33:58ethan.furmansetrecipients: + ethan.furman, JEphron
2021-06-10 15:33:58ethan.furmansetmessageid: <>
2021-06-10 15:33:58ethan.furmanlinkissue44356 messages
2021-06-10 15:33:58ethan.furmancreate