[Python-Dev] Dict suppressing exceptions

Guido van Rossum guido at python.org
Sat Aug 12 06:06:13 CEST 2006


On 8/11/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Michael Chermside schrieb:
> > I propose that we institute a new policy. The policy should state:
> >
> >    __eq__ methods should always return True or False. They should
> >    only raise an exception if there is some internal error within
> >    one of the objects being compared -- they should never raise
> >    an exception because the other object is of an unexpected type.
>
> That policy is currently difficult to implement, but reasonable
> (difficult because it is quite some code to write).

Why? Are you thinking of the standard library, or of an end user's
__eq__ method? Returning False from your __eq__ if other's type is
unexpected doesn't seem a lot of code. Or am I misunderstanding
something?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list