12 Apr
2008
12 Apr
'08
8:11 p.m.
Mark Summerfield schrieb:
This is the kind of thing I'm looking for:
flags = Enum("OK", "ERROR", "OTHER") # defaults to sequential ints flags.OK == 0 flags.ERROR == 1 flags.OTHER == 2 flags.OK = 5 # exception raised flags.FOO # exception raised str(flags.OK) == "OK"
I once wrote this: http://twoday.tuwien.ac.at/pub/files/enum I don't know how good this is, though. -panzi