[Python-3000] callable()

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jul 26 12:32:11 CEST 2006


Nick Coghlan wrote:

> The use case is being able to block the inheritance of special methods 
> that object provides default implementations for (like '__hash__'), such 
> that a hasattr() check (or a check for a type slot being 0) for those 
> special methods will actually fail.

Maybe descriptors could be given a __has__ slot that got
called by hasattr() if present. Then a descriptor could
be created that would have this effect, and your

>   class Unhashable(object):
>       __hash__ = Undefined

spelling could be used.

--
Greg



More information about the Python-3000 mailing list