Daniel Stutzbach <dan...@stutzbachenterprises.com> added the comment:

In this case, the concrete class is the one missing a method.  

Concrete classes are allowed to provide more features than the corresponding 
ABC, but the converse is not true to the best of my knowledge.

dict_keys .register()s as supporting the Set ABC, so it does not automatically 
pick up the method through inheritance.  Put another way:

>>> # dict_keys provides the Set ABC API
>>> isinstance({}.keys(), collections.Set)
True

>>> # The Set ABC provides isdisjoint
>>> hasattr(collections.Set, 'isdisjoint') 
True

>>> # Ergo, dict_keys should provide isdisjoint ... but it doesn't
>>> hasattr({}.keys(), 'isdisjoint')       
False

See also Issue9213 for another case where a concrete class is missing a method 
provided by an ABC it claims to support.

I sort of wonder if .register() should verify that the concrete class provides 
all of the methods of the ABC.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9212>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to