I'm not sure if I'd be framing the question correctly but I'll try my best to explain my problem.
I have the code below where x and y are set to None in the beginning. In a new function, based on a condition, x and y are updated.
class problem()
def __init__(self):
self.x = None
self.y = None
def function(self):
if some_condition:
self.x = 10
self.y = 5
else:
self.x = None
self.y = None
The problem I have here is the total number of variables in __init__() are around 10 and all of these have to set to a value or reset back to original value based on the condition.
Is there a pythonic way to reset the variables back to original __init__() values when the if condition fails?
__init__andfunctionseems the soundest idea