pychecker - sets.Set need to be overridden

Peter Otten __peter__ at
Mon Jan 17 17:43:44 CET 2005

Istvan Albert wrote:

> if I have this code:
> import sets
> class Foo:
>      x = sets.Set()
> then pychecker says:
> Methods (__cmp__, __hash__) in sets.Set need to be overridden
> in a subclass
> I don't get this message. What is it trying to say, and why?

The minimal example is actually

import sets

The Set class has implementations for __cmp__() and __hash__() that
unconditionally raise an exception. pychecker assumes that these methods
are "abstract", i. e. meant to be overriden by a subclass, and warns that
you are instantiating an abstract base class, while the intention of the
Set class author was to make Sets "uncomparable" and unhashable by
overriding the corresponding superclass methods.


More information about the Python-list mailing list