Closed
Description
Is there any interest in providing an @override
decorator for base classes that re-implement (override) the functions of abstract classes? It could be potentially helpful in distinguishing between the functions that are inherited vs. functions that are unique to a class.
from abc import ABCMeta, abstractmethod
class A(metaclass=ABCMeta):
@abstractmethod
def f(self) -> None: pass
class B(A):
@override
def f(self) -> None:
print('Overridden function')
def g(self) -> None:
print('Non-overridden function')
There seem to be rough implementations of such a decorator here - http://stackoverflow.com/questions/1167617/in-python-how-do-i-indicate-im-overriding-a-method.
Metadata
Metadata
Assignees
Labels
No labels