In an attempt to format my code a little better to avoid redundancies in multiple methods doing the same stuff for different classes, I'm faced with the following problem :
# problematic method
def a(self, b, c):
result = test(b)
if (result):
c = None # <- local variable c is assigned but never used
return
# main code
obj.a(obj.b, obj.c)
And the obj's variable c is never set to None.
The current working code that I'm trying to reformat is the following :
# working method
def a(self):
result = test(self.b)
if (result):
self.c = None
return
# main code
obj.a()