PEP 354: Enumerations in Python

Ben Finney bignose+hates-spam at benfinney.id.au
Mon Feb 27 19:46:49 EST 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> Ben Finney <bignose+python at benfinney.id.au> 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.

By way of explanation, my earlier implementations of this didn't have
enumerations as sequences. Now that the design has converged more on a
sequence and container idiom, I agree with you.

I'll amend the specification so empty enumerations are not an
error. (This will also remove the last remaining exception class from
the specification, making it cleaner still. Good.)

-- 
 \       "I love to go down to the schoolyard and watch all the little |
  `\   children jump up and down and run around yelling and screaming. |
_o__)          They don't know I'm only using blanks."  -- Emo Philips |
Ben Finney



More information about the Python-list mailing list