[Python-Dev] constant/enum type in stdlib

Antoine Pitrou solipsis at pitrou.net
Tue Nov 23 19:07:56 CET 2010


Le mardi 23 novembre 2010 à 12:50 -0500, Isaac Morland a écrit :
> Each enumeration is a type (well, OK, not in every language, presumably, 
> but certainly in many languages).  The word "basic" is more important than 
> "types" in my sentence - the point is that an enumeration capability is a 
> very common one in a type system, and is very general, not specific to any 
> particular application.

Python already has an enumeration capability. It's called range().
There's nothing else that C enums have. AFAICT, neither do enums in
other mainstream languages (assuming they even exist; I don't remember
Perl, PHP or Javascript having anything like that, but perhaps I'm
mistaken).

Regards

Antoine.




More information about the Python-Dev mailing list