David Wurmfeld wrote:

I am new to python; any insight on the following would be appreciated, even if it is the admonition to RTFM (as long as you can direct me to a relevant FM)

Is there a standard approach to enumerated types? I could create a dictionary with a linear set of keys, but isn't this overkill? There is afterall a "True" and "False" enumeration for Boolean.

To actually answer your question, no, there is no standard for enums in python. There are custom hacks for it that you can search for.


This is a good sugestion for Python 3.0, a.k.a. Python 3000:
http://www.python.org/cgi-bin/moinmoin/Python3.0

In the future you may be able to to this:

enum Color:
     Red
     Green
     Blue

However, Python 3.0 is likely years away. If you want to know how to run this code today, consult Fredrik Lundh.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to