[Python-ideas] PEP XXX - Competitor with PEP 435: Adding an enum type to the Python standard library

Andrew Barnert abarnert at yahoo.com
Tue Mar 12 17:59:57 CET 2013

On Mar 12, 2013, at 8:36, Eli Bendersky <eliben at gmail.com> wrote:

> It is actually better, because it emphasizes that NamedInt is just that, not a kind of Enum. There's just one enum. Moreover, I'm not sure why strings need to be named (they name themselves just fine). And moreover+, Bitmask IMHO is completely unnecessary in Python.

It's necessary everywhere we interface with C APIs and binary formats that use them. Even the stdlib is full of candidates--the flags in os, stat, etc. are all bitmasks.

I could see arguing that these shouldn't be considered the same kind of thing as an enum, or are too complex to handle in what should be a simple enum library. But I can't see how you can say we don't need them. The situation is identical to ordered named int--same status quo, same downsides to the status quo, etc.--except for the implementation complexity. 

More information about the Python-ideas mailing list