Martin v. Löwis wrote:

> Now I looked at it, and think that the recipe is broken. It should
> add an __eq__ method which is

>   def __eq__(self, other):
>       return type(self) is type(other) \
>           and self.EnumType is other.EnumType \
>           and self.__value==other.__value)

Absolutely.  But the point is that there are a lot of these broken
objects out there; this one was on a 5-star recipe that has been
around for a while, and still no one caught it.  That suggests the bug
could reasonably be in any 3rd-party library.

The existence of a (common) bug in someone else's code shouldn't keep
me from using a dictionary of objects.

hash was just changed to support the common use of id, even though
some people argued it was *really* a bug in the classes themselves.
This is a similar situation.

-jJ
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to