Say I have the following:
class Parent(object):
[...]
def func(self, list):
for item in list:
if condition1:
do something
class Child(Parent):
[...]
def func(self, list):
for item in list:
if condition1 and condition2:
do something
What would be an elegant way to add condition2 to func without having to recopy the entire function? Note that I actually have two additional conditions in nested ‘ifs’.
If you have access to Parent, you could do