![](https://secure.gravatar.com/avatar/e02c3c71bc8475f725a31159f9242393.jpg?s=120&d=mm&r=g)
2008/4/12, Mathias Panzenböck <grosser.meister.morti@gmx.net>:
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
Also: http://norvig.com/python-iaq.html http://www.python.org/doc/essays/metaclasses/Enum.py http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/67107 http://www.faqts.com/knowledge_base/view.phtml/aid/4415
I don't know how good this is, though.
-panzi _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- -- Guilherme H. Polo Goncalves