Message387181
When I work with ABC classes usually I faced a problem - I forget to implement one of the methods or make a typo in the method name. In such case I will know about it only when I will try to instantiate a class.
In case when a hierarchy is big you should go through classes and find the exact class where the problem is.
With this feature, in a case when a class inherits from strict ABC and doesn't implement all abstract methods of strict classes it will fail at class declaration rather than at instance creation as with regular ABC classes.
As an option, I can run mypy every time before start the python interpreter.
The perfect behavior for me is a case when ABC class will be strict by default, but it will break the existing code.
Examples to explain the idea:
```
from abc import ABC, abstractmethod
class Base(ABC):
@abstraabstractmethod
def foo(self):
pass
class A(Base, ABC): # totally okay, because class directly inherits from ABC
pass
class B(Base): # will fail, because class doesn't implement foo method
pass
```
Raymond, could you please explain why the current behavior is default. |
|
Date |
User |
Action |
Args |
2021-02-17 18:35:04 | uriyyo | set | recipients:
+ uriyyo, gvanrossum, rhettinger |
2021-02-17 18:35:04 | uriyyo | set | messageid: <1613586904.85.0.210376566237.issue43243@roundup.psfhosted.org> |
2021-02-17 18:35:04 | uriyyo | link | issue43243 messages |
2021-02-17 18:35:04 | uriyyo | create | |
|