Enumming
Larry Whitley
ldw at us.ibm.com
Mon Aug 21 16:13:06 EDT 2000
I come to Python from C++ and am wondering how Pythoners do the equivalent
of the C++ enum. My current approach is to have an enum class with some
constants in it for use with my regular class. It there something more
clever that I've missed?
Let's say I have a list of tuples like so:
myList = []
for i in range( 10 ):
myList.append( functionA(), funcationB(), functionC(), functionD(),
functionE() )
Here's my class of enums:
class E:
a,b,c,d,e = range( 5 )
Later, I use the enums to access my list:
myC = myList[5][ E.c]
Is this the usual approach?
Larry
More information about the Python-list
mailing list