Op 2006-02-27, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > Paul Rubin wrote: > >> Ben Finney <[EMAIL PROTECTED]> writes: >> >>>Enumerations with no values are meaningless. The exception >>>``EnumEmptyError`` is raised if the constructor is called with no >>>value arguments. >> >> >> Why are empty enumerations not allowed? Empty sets, empty lists, >> empty dictionaries are all allowed. I don't see any obvious benefits >> to not allowing empty enumerations. > > What is an empty enum? How and when would you use it?
It could come up in a tool where the tool constructs an identifier list somehow and then an EnumType from this list. IMO this is just as usefull as the possibility to do the following: for a in []: ... One could argue that there is no need to loop over an empty list, because looping over an empty list is a noop. But it would needlessly complicate code if every time we wanted to loop over a list we had to code like this. if lst: for a in lst: Sure as long as we look at Enum as something that will be something literally provided by the programmer, there is little use for an Empty Enum. Just as there is little use for looping over an empty list if you literally provide that empty list, but maybe somewhere in the future some automation tool will produce scripts that use Enums. Why should we possibly make the future production of such a tool more difficult because we can't imagine the use of Empty Enums now? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list