PEP 354: Enumerations in Python

Terry Reedy tjreedy at udel.edu
Tue Feb 28 14:26:49 EST 2006


"Stefan Rank" <stefan.rank at ofai.at> wrote in message 
news:440415A1.7070503 at ofai.at...
> recent examples from this list:
>
> 2006-01-03: http://www.nabble.com/Re%3A-Regex-anomaly-p2179421.html
> 2006-02-20:
> http://www.nabble.com/Re%3A-Regular-expression-gone-mad-p3029028.html

If the re flags were implemented as instances of object instead of int,
then misuse of them as int args would be excepted.  I don't know if such a 
change would otherwise cause a problem.

I wonder whether a subclass of object (EnumSet?) that allowed for 
initialization with a better string representation and that disabled order 
comparisons would fill the bill for unordered enum.

As Steven Bethard also noted, there seem to be a need for two Enum 
subclasses:
EnumSet and EnumSeq.

Terry Jan Reedy






More information about the Python-list mailing list