On 2013-05-10, Guido agreed to accept PEP 435 into the Python 3.4 standard library. This means that Python finally has builtin support for enumerations!
There is a backport available for Python 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4. It's on Pypi as enum34.
Declaration:
>>> from enum import Enum
>>> class Color(Enum):
... red = 1
... green = 2
... blue = 3
Representation:
>>> print(Color.red)
Color.red
>>> print(repr(Color.red))
Iteration:
>>> for color in Color:
... print(color)
...
Color.red
Color.green
Color.blue
Programmatic access:
>>> Color(1)
Color.red
>>> Color['blue']
Color.blue
For more information, refer to the proposal. Official documentation will probably follow soon.