-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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.
jayonthegreen, ypankovych, z0u, 6harat, pj and 4 more
Metadata
Metadata
Assignees
Labels
No labels