PEP 354: Enumerations in Python

JW John-Whitlock at ieee.org
Tue Feb 28 08:33:46 EST 2006


It seems the concensus is that empty enums should be allowed for
consistancy, and to support the loop that doesn't.  I thought I'd find
some data points in other languages as a guide:

* C - builtin, empty enumerations not allowed
* C++ - builtin, empty enumerations allowed.  C++ doesn't have
iteration over a enumeration, except as a side-effect of direct
translation from elements to integerts (and then, only for a
sequentially assigned enumeration).  An enumeration is a type, so it
can be thrown (raised) as an exception -
http://oopweb.com/CPP/Documents/CPPAnnotations/Volume/cplusplus16.html#EMPTYENUM
* Java - builtin, empty enumerations allowed previously to 1.5, but
maybe not after -
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5081785
* OCaml - library, empty enumerations allowed as a consequence of being
able to add and remove enumeration elememts:
http://ocaml-lib.sourceforge.net/doc/Enum.html

I realize this is a strange and short list, but it's all I can do with
5 min of Google and a little testing.




More information about the Python-list mailing list