On 27 feb 2006, at 10:13, Tim Chase wrote: >> Uniqueness imposes an odd constraint that you can't have >> synonyms in the set: >> >>>>> shades = enum({white:100, grey:50, gray:50, black:0}) > > Blast, I hate responding to my own posts, but as soon as I > hit Send, I noticed the syntax here was biffed. Should have > been something like > >>>> shades = enum(("white", 100), ("grey", 50), > ("gray",50), ("black", 50)) > > Same could go for days of the week: > >>>> dow=enum(("sunday", 0), ("monday", 1), > ("start_of_work_week", 1), ... ("friday", 5), > ("end_of_work_week", 5)...)
if enum would handle a dict as an input parameter by replacing it with the dict's iteritems() this is equivalent. --eric -- http://mail.python.org/mailman/listinfo/python-list