pychecker - sets.Set need to be overridden
Peter Otten
__peter__ at web.de
Mon Jan 17 11:43:44 EST 2005
Istvan Albert wrote:
> if I have this code:
>
> import sets
>
> class Foo:
> x = sets.Set()
>
> then pychecker says:
>
> test.py:4: 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
sets.Set()
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.
Peter
More information about the Python-list
mailing list