class Base(object):
...
def fun(self):
raise NotImplementedError
Source: http://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods
Question
I'd like to designate some of my baseclass functions for override. (The override should not be necessarily enforced.) What is the proper way of doing this?
I mean sth like
class Base(object):
...
@abstractmethod
def fun(self):
pass
class Derived(Base):
@override
def fun(self):
pass
EDIT:
I want my code to raise an UnimplementedException if the function is not overridden.
Solution
class Base(object):
...
def fun(self):
raise NotImplementedError
Source: http://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods