Trees | Indices | Help |
|
---|
|
object --+ | tuple --+ | Enumeration
This class represents an enumeration. You should not normally create multiple instances of the same enumeration, instead create one with however many references are convenient.
The enumeration is a tuple of all of the values in it. You can iterate through the values, perform 'in' tests, slicing, etc. It also includes functions to lookup specific values by name, or names by value.
You can specify your own element values, or use the create factory method to create default Elements. These elements are unique system wide, and are ordered based on the order of the elements in the enumeration. They also are _repr_'d by the name of the element, which is convenient for testing, debugging, and generation text output.
Note: pickling this class with Elements will fail as they contain cyclic references that it cannot deal with
To Do: implement proper pickle __getstate__ and __setstate__ that deal with that problem
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
a new object with type S, a subtype of T |
|
|
|||
_slots_ =
|
|
|||
Inherited from |
|
|
|
The arguments needed to construct this class are a list of element names (which must be unique strings), and element values (which can be any type of value). If you don't have special needs, then it's recommended that you use Element instances for the values. This constructor is normally called through the create factory (which will create Elements for you), but that is not a requirement.
|
|
Look up the name of an enumeration element, given it's value. If there are multiple elements with the same value, you will only get a single matching name back. Which name is undefined.
|
|
|
|
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Apr 19 18:00:13 2011 | http://epydoc.sourceforge.net |