PEP 354 -- "in" operator?
Roy Smith
roy at panix.com
Mon Feb 27 10:30:14 EST 2006
More information about the Python-list mailing list
Mon Feb 27 10:30:14 EST 2006
- Previous message (by thread): PEP 354 -- "in" operator?
- Next message (by thread): changing params in while loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
If I have an enum, how can I verify that it's a legal value? Can I do:
Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')
def foo (day):
if day not in Weekdays:
raise ValueError
Also, do enums have __dict__ slots? Can I do something like:
day = 'sun'
print Weekdays.__dict__[day]
- Previous message (by thread): PEP 354 -- "in" operator?
- Next message (by thread): changing params in while loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list