PEP 354: Enumerations in Python

Roy Smith roy at panix.com
Mon Feb 27 10:17:47 EST 2006


In article <4402AB7F.7070804 at REMOVEMEcyber.com.au>,
 Steven D'Aprano <steve at REMOVEMEcyber.com.au> wrote:

> But if you have a good usage case for an empty enum, 
> please feel free to tell us.

I could see empty enums being useful in machine-generated code, perhaps 
when generating wrappers around C library APIs.  There might be some reason 
to exclude certain values that exist in the C API from the Python wrapper.  
It's easier to just generate an empty enum than to notice that it's empty 
and do something else.

Yeah, I know this is not a very strong argument, but I also can't see any 
strong reason to outlaw empty enums either.  You can have empty tuples, 
lists, sets, and dictionaries.  If you count "pass", you can also have 
empty code blocks and classes.  Why not empty enums?  What harm does it do 
to allow them?



More information about the Python-list mailing list