[Python-Dev] constant/enum type in stdlib (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Nov 23 22:26:58 CET 2010


Antoine Pitrou wrote:

I don't understand why people insist on calling that an "enum". enum is a C legacy and it doesn't bring anything useful as I can tell.

The usefulness is that they can have a str() or repr() that displays the name of the value instead of an integer.

The bool type was added for much the same reason -- otherwise we would simply have gotten builtin names False = 0 and True = 1.

-- Greg



More information about the Python-Dev mailing list