I am making a program with some inherited classes but my program needs to know whether a class' functions are being called directly from the class or from a base class e.g.
class Letters():
def letter(): ...
...
class ABC(Letters):
def __init__(self):
if from_base_class:
raise Exception
def A(): ...
def B(): ...
def C(): ...
==== terminal: ====
>>> myclass = ABC()
>>> myclass.letter()
[with all of the line numbers here]
Exception
How can I implement this into my code?
So did you mean to raise an exception?
class Letters():
def letter(self): ...
...
class ABC(Letters):
def letter(self):
raise NotImplementedError