This module provides an implementation for enumerate.
The enum factory EnumFactory() builds a enumerate from a list of names and assigns to these constants a value from 0 to N-1, where N is the number of constants:
enum1 = EnumFactory('Enum1', ('cst1', 'cst2'))
then we can get a constant’s value with:
enum1.cst1
and the number of constants using:
len(enum1)
The enum factory ExplicitEnumFactory() permits to specify the values of the constants:
enum2 = ExplicitEnumFactory('Enum2', {'cst1':1, 'cst2':3})
We can test if a value is in the enum using:
constant_value in enum2