Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Provide enumerated type classes

Project Description

This Python module provides a metclass-based approach to providing enumerated types in Python. Enumerated types are defined by define a subclass of the Enum class, with the class attributes defined the enumerated values. Dictionary style methods are also provided for things such as accessing and iterating over the enumeration values. Enumerated type classes can be further subclassed and/or merged. Once enumerated type classes have been defined, they cannot easily be modified.

Example of use:

>>> class Season(Enum):
...    summer = 'Summer'
...    autumn = 'Autumn'
...    winter = 'Winter'
...    spring = 'Spring'
>>> this_season = Season.spring
>>> Season.values()
['Summer', 'Autumn', 'Winter', 'Spring']

This requires Python 2.2 or greater.

Release History

Release History

This version
History Node

0.3

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting