I am implementing a subclass Child
where an overwritten method some_method
calls the parent method first. I want to use variable a
from the parent method in the child method. Is there a neat way to do this without having to modify the code of Parent
?
class Parent:
def __init__(self):
pass
def some_method(self):
a = 0
class Child(Parent):
def __init__(self):
super().__init__()
def some_method(self):
super().some_method()
b = a - 1 # Here I would like to keep using `a`