[issue20897] @abstractmethod does not enforce method signatures

R. David Murray report at bugs.python.org
Tue Mar 18 15:05:25 CET 2014


R. David Murray added the comment:

The fact that you say the method is "_junk(self)" and say the other classes don't override it makes me think you are thinking that methods with the same name are different from a subclasses perspective if they have different signatures.  In Python this is not true.  You cannot have methods with the same name and different signatures in the same class, so in Python "override" means "has a method with the same name".  Therefore the implementation is currently behaving in accordance with the documentation.

Checking for compatible signatures would be a new feature by our rules regardless of whether it is considered an API bug or not.  This is because it could cause existing working programs to break, and so can't be changed in a maintenance release.

I think I agree with Terry that this should be discussed on python-ideas first, although insofar as ABCs are useful, it seems like a reasonable feature to me.  And probably not hard to do now that we have signature objects.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20897>
_______________________________________


More information about the Python-bugs-list mailing list