Ben Finney wrote: > The problem with "is the same value" as an explanation for '==' is > that it doesn't help in cases such as:: > > >>> ShirtSize = Enum('small', 'medium', 'large') > >>> AppleSize = Enum('small', 'large') > > What should be the result of this comparison:: > > >>> ShirtSize.small == AppleSize.small > > Are they "the same value"? They're both "small" (and they both coerce > to the same string value, and in this case the same integer value).
Is it possible to make it have the following sort of behaviour? : >>> ShirtSize.small == AppleSize.small True >>> ShirtSize.small is AppleSize.small False It works for comparing a boolean (True) vs. an integer (1), so it has some sort of precedent. (Especially if you make the tenuous assumption that True,False are language-supported 'enums' for 0 and 1.) -- Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list