"Erik Max Francis" <[EMAIL PROTECTED]> wrote: > Pierre Barbier de Reuille wrote: > > > When you need some symbols in your program, what do you use in Python ? > > > > For example, an object get a state. This state is more readable if > > expressed as a symbols, for example "opened", "closed", "error". > > Typically, in C or C++, I would use an enum for that: > > enum OBJECT_STATE > > { > > opened, closed, error > > } > > OPENED, CLOSED, ERROR = range(3) > > object.state = OPENED
Or if you want something closer to real enumerations, there are several recipes in the cookbook. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 seems to be pretty good according to the ratings. George -- http://mail.python.org/mailman/listinfo/python-list