[Python-ideas] Adding collections.abc.Ordered

Serhiy Storchaka storchaka at gmail.com
Sat Dec 26 19:09:07 EST 2015


On 27.12.15 01:05, Guido van Rossum wrote:
> There is a precedent for declaring that a method isn't implemented:
> __hash__. The convention is to set it to None in the subclass that
> explicitly doesn't want to implement it. The __subclasshook__ in
> collections.Hashable checks for this. The pattern is also used for
> __await__.

Yes, this was the first thing that I tried, but it doesn't work, as 
shown in my example in issue25864. This is yet one thing that should be 
fixed in Reversible.

May be we have to use this idiom more widely, and specially handle 
assigning special methods to None. The error message "'sometype' can't 
be reverted" looks better than "'NoneType' is not callable".



More information about the Python-ideas mailing list