Constants and Enums
Fred Gansevles
gansevle at cs.utwente.nl
Fri Jun 30 03:56:12 EDT 2000
Recentely I posted the Enum module
It is now at http://www.cs.utwente.nl/~gansevle/python/Enum.py
With that you can do the following:
import Enum
color = Enum.enum('red', 'yellow', 'green', 'blue', green=20)
print color
print color.yellow
print color(21)
for col in color:
print color(col), '=', col
It may be a starting point, or just wat you need.
--
-----------------------------------------------------------------------
---- Linux/Windows-NT/IntraNetware Administrator ----
-- Whenever it sounds simple, I've probably missed something! ... Me --
-----------------------------------------------------------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list