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-10-17.00:21:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The following code should work (from

    class BaudRate(Enum):

        cls = vars()
        regexp = r"(?:^|,)B(?P<rate>\d+)"
        rates = sorted(map(int, re.findall(regexp, ",".join(dir(termios)))))
        for value in rates:
            cls['B%d' % value] = value

        def valid_rate(cls, value):
            return (any(value == item.value for item in cls))

This doesn't work because EnumMeta does not allow names to be reassigned nor deleted.  aenum gets around this by allowing an _ignore_ attribute which contains the names that should not be tracked (and, in fact, those names are removed from the final class).

Unless a better idea is put forward, I will add _ignore_ support to Enum.
Date User Action Args
2017-10-17 00:21:55ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky
2017-10-17 00:21:55ethan.furmansetmessageid: <>
2017-10-17 00:21:55ethan.furmanlinkissue31801 messages
2017-10-17 00:21:53ethan.furmancreate