◐ Shell
clean mode source ↗

Message 273012 - Python tracker

@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?