[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Guido van Rossum
guido at python.org
Sat Apr 13 17:33:42 CEST 2013
>> It is applicable, in the sense that os.O_CREAT etc can be IntEnum values.
>> Their bitset operation results will be simple integers. It's not planned to
>> add a special enum for this - this was ruled against during the Pycon
On Sat, Apr 13, 2013 at 7:30 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> But IntEnum is useless in such cases because a resulting mask will be an
> integer an will lost its convenient printable representation. There is
> almost no benefit of IntEnum before int constant.
If you really wanted that you could define an int subclass that does
better and use that -- IntEnum is just one example of how you can
override the value type of Enum. (And yes, I am now +1 on documenting
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev