[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread R. David Murray
R. David Murray added the comment: Or, in 3.4, class META(abc.ABC). OK, since Eric agrees that this is python-ideas material, we'll close this issue for now. If you get consensus for it on python-ideas, the issue can be reopened (or a new one started, whichever turns out to be appropriate).

[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread Eric Snow
Eric Snow added the comment: Oops, typos. > Both abstractmethod and abstractproperty work by setting __isabstractmethod__ to True on the decorated function. Then type.__new__ That should be type.__call__ or object.__new__, I don't remember which. > looks for any attributes of the current clas

[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread Eric Snow
Eric Snow added the comment: Both abstractnethod and abstractproperty work by setting __isabstractmethod__ to True on the decorated function. Then type.__new__ looks for any attributes of the current class (including inherited ones) that have __isabstractmethod__ set to True. The signature o

[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread R. David Murray
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

[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread Claudiu.Popa
Claudiu.Popa added the comment: Hello. In 3.3 you can instantiate META class, because it does not properly say that it wants abc.ABCMeta as a metaclass. For this, you have to write your class as such: class META(metaclass=abc.ABCMeta): @abc.abstractmethod def _junk(self): ... -

[issue20897] @abstractmethod does not enforce method signatures

2014-03-18 Thread the mulhern
the mulhern added the comment: I feel that I worded this in a way that makes it look like I'm asking for an enhancement, not reporting a bug, so I'll try again. The documentation for 2.7.6 and 3.4.0 says: Using this decorator requires that the class’s metaclass is ABCMeta or is derived from i

[issue20897] @abstractmethod does not enforce method signatures

2014-03-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: Unless the behavior contradicts the docs, it is not a bug. If the looser behavior in 3.x is intentional, a request to reverse direction will likely be rejected. Like many enhancement requests, I think this would better be discussed on python-ideas first, along

[issue20897] @abstractmethod does not enforce method signatures

2014-03-12 Thread the mulhern
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): ... p