27 Jul
2011
27 Jul
'11
11:52 p.m.
Ethan Furman
In most cases I agree, but there can be exceptions. Consider:
class StoveTemps(Enum): off = 0 low = 15 medium = 50 high = 85
That doesn't seem like an appropriate use of an enumerated type, then. For an enumerated type, the integers are arbitrary and the important part is the name. If the integer values actually *mean* something, then let's have them as name bindings to those values.
In such a case I see no issues with
if temp < StoveTemps.medium: what_ever()
-- \ “Anger makes dull men witty, but it keeps them poor.” | `\ —Elizabeth Tudor | _o__) | Ben Finney