[Python-3000] Need help completing ABC pep

Nick Coghlan ncoghlan at gmail.com
Fri Apr 20 11:59:45 CEST 2007

Guido van Rossum wrote:
> I've started a PEP on Abstract Base Classes (ABCs), PEP 3119:
>     http://www.python.org/dev/peps/pep-3119/
> While I'm not ready yet to answer tough questions about this compared
> to alternative proposals, I *am* ready for feedback on the various
> open issues sprinkled throughout the current text, especially
> concerning decisions regarding exactly which operations to include in
> the various ABCs, and also regarding the level of detail required in
> the PEP.

It's not listed as an open issue, but when looking at the list of ABCs, 
I noticed a potential solution to a different problem we have 
occasionally wrestled with: the unfortunate side-effects of having a 
default __hash__ method defined on object.

If the details of collections.Hashable.__hash__ are declared to be 
implementation dependent rather than having it always return 0, then we 
can get rid of object.__hash__.

For CPython, collections.Hashable.__hash__ would then just invoke id() 
on the object, and other implementations can also do whatever they 
currently do for object.__hash__


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-3000 mailing list