enum_meta 0.3
Provide enumerated type classes
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.
- Author: Tim Wegener <twegener at radlogic com au>
- Home Page: http://www.radlogic.com.au/downloads.htm
- Download URL: http://www.radlogic.com/releases/enum_meta.py
- Keywords: enum, enumeration, enumerated, type, metaclass, class
- Categories
- Package Index Owner: twegener
- DOAP record: enum_meta-0.3.xml
Log in to rate this package.
