[issue27598] Add SizedIterable to collections.abc and typing
Neil Girdhar
report at bugs.python.org
Thu Aug 18 02:08:47 EDT 2016
Neil Girdhar added the comment:
@gvanrossum is there any reason that subclasshook is implemented by overriding instead of cooperation? E.g.,:
class Sized(metaclass=ABCMeta):
@classmethod
def __subclasshook__(cls, C):
return (super().__subclasshook__(C) and
any("__len__" in B.__dict__ for B in C.__mro__))
etc. And then Collection does not need to implement subclasshook since its base classes cooperate?
----------
nosy: +neil.g
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27598>
_______________________________________
More information about the Python-bugs-list
mailing list