[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I should have add a bit more explanation. The logic for ABCs instantiation is roughly: if any(method.is_abstract() for method in dir(cls)): raise TypeError('I refuse to instantiate') inst = instantiate(cls) The edge case for any() is

[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread R. David Murray
R. David Murray added the comment: The docs start out with "as outlined in PEP 3119; see the PEP for why this was added to Python". I think it would be a good doc enhancement request to extract the motivation and other description out of that pep and put it in the main docs in a suitable for

[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread Alex Corcoles
Alex Corcoles added the comment: Are you referring to something akin to Java's marker interfaces? That is, a class with no methods which you inherit from just for semantic meaning (e.g. Java's serializable interface that you implement to indicate that the class is designed for pickling). In

[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur. -- nosy: +rhettinger resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread R. David Murray
R. David Murray added the comment: No, you could create an ABC whose only purpose was to be a target of register calls. As with the issue you reference, this is something better implemented in a linter. I'll leave this open for at least one other dev to concur and close, though. --

[issue32060] Should an ABC fail if no abstract methods are defined?

2017-11-17 Thread Alex Corcoles
New submission from Alex Corcoles : Hi, $ python3 Python 3.5.3 (default, Jan 19 2017, 14:11:04) >>> import abc >>> class Foo(abc.ABC): ... pass ... >>> Foo() <__main__.Foo object at 0x7f253e6dcb38> I think declaring a class as ABC without declaring any abstract method is an error. I've