Am 23.09.2010 16:37, schrieb Tarek Ziadé:
ABC __subclasshook__ implementations will only check that the method is present in the class. That's the case for example in collections.Container. It will check that the __contains__ method is present but that's it. It won't check that the method has only one argument. e.g. __contains__(self, x)
The problem is that the implemented method could have a different list of arguments and will eventually fail.
I'm not concerned about this in the least. Whoever implements a special method with the wrong signature has more pressing problems than a false- positive ABC subclass check. And AFAIK, our ABCs only check for special methods.
Using inspect, we could check in __subclasshook__ that the arguments defined are the same than the ones defined in the abstractmethod.-- the name and the ordering.