New submission from the mulhern: Hi!
Here is a simple class hierarchy: >>> import abc >>> class META(object): ... __metaclass__ = abc.ABCMeta ... @abc.abstractmethod ... def _junk(self): ... pass ... >>> class Sub(META): ... def _junk(self, other): ... pass ... >>> class Subber(META): ... def _junk(self): ... pass ... >>> class SuperSubber(META): ... pass ... In 2.7.5 I can instantiate an object of Sub or Subber, although Sub does not really override META's abstract method. I think it would be better if I could not instantiate Sub, because the signature of the abstract method in META is different from the signature of the overriding method in Sub. I can not instantiate SuperSubber, I get a TypeError. That seems correct. In 3.3.2 I can instantiate all three, Sub, Subber, and SuperSubber. I would prefer to only be able to instantiate Subber, since it is the only class that truly overrides the abstract method _junk in META. - mulhern ---------- components: Library (Lib) messages: 213256 nosy: the.mulhern priority: normal severity: normal status: open title: @abstractmethod does not enforce method signatures type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20897> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com