Message399649
Tomasz -- as discussed in the original BPO issue for `abstractmethod` implementations (https://bugs.python.org/issue1706989), this works as a workaround:
```
>>> from abc import ABCMeta
>>> class AbstractAttribute:
... __isabstractmethod__ = True
...
>>> class Foo(metaclass=ABCMeta):
... abstract_attribute_to_be_overriden = AbstractAttribute()
...
>>> class Bar(Foo): pass
...
>>> b = Bar()
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: Can't instantiate abstract class Bar with abstract method abstract_attribute_to_be_overriden
```
It would be nice to have something like this in the `abc` module, though. |
|
Date |
User |
Action |
Args |
2021-08-16 11:07:55 | AlexWaygood | set | recipients:
+ AlexWaygood, ajoino, rzepecki.t |
2021-08-16 11:07:55 | AlexWaygood | set | messageid: <1629112075.09.0.70555906923.issue44905@roundup.psfhosted.org> |
2021-08-16 11:07:55 | AlexWaygood | link | issue44905 messages |
2021-08-16 11:07:55 | AlexWaygood | create | |
|