Functions | |
| def | create |
| Creates a new class which provides enum-like functionality. | |
Variables | |
| __value | |
| def IECore::Enum::create | ( | names | ) |
Creates a new class which provides enum-like functionality.
The class has an attribute for each name passed, whose value is the instance of the Enum for that name. Enum instances hold an integer value which can be retrieved using int( e ), and the name that value signifies can be retrieved using str( e ). Enum instances can be compared for equality and hashed to allow their use in dictionaries etc.
For example :
> E = IECore.Enum.create( "Apple", "Orange" ) > a = E.Apple > print a, int( a )
Apple, 0
assert( E.Orange == E( 1 ) ) assert( E.Orange != E.Apple )
1.5.8