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 ethan.furman, ned.deily
Date 2018-10-05.20:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
from enum import Enum, unique

class StrEnum(str, Enum):
    def __new__(cls, *args, **kwargs):
        for a in args:
            if not isinstance(a, str):
                raise TypeError("Enumeration '%s' (%s) is not"
                                " a string" % (a, type(a).__name__))
        return super(StrEnum, cls).__new__(cls, *args, **kwargs)

class Decision(StrEnum):
    """Decision results/strategy enumeration."""


Traceback (most recent call last):
  File "test", line 14, in <module>
    class Decision(StrEnum):
  File ".../cpython/Lib/", line 222, in __new__
    enum_member._value_ = member_type(*args)
  File ".../cpython/Lib/", line 309, in __call__
    return cls.__new__(cls, value)
  File ".../cpython/Lib/", line 545, in __new__
    return cls._missing_(value)
  File ".../cpython/Lib/", line 558, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'REVERT' is not a valid StrEnum
Date User Action Args
2018-10-05 20:12:48ethan.furmansetrecipients: + ethan.furman, ned.deily
2018-10-05 20:12:48ethan.furmansetmessageid: <>
2018-10-05 20:12:48ethan.furmanlinkissue34909 messages
2018-10-05 20:12:48ethan.furmancreate