Alex Waygood <alex.wayg...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44905>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to