I have class with a lot of fields that can be changed while my program is running, but when I create new object in my init I only can change some of them, I want to save those changes to JSON file and later be able to create new object with those variables. Is there any other way to do it other than making my init taking like 100 arguments?
In other words I would love it to be sth like that:
class MyClass:
def __init__(self, q, w):
self.q = q
self.w = w
self.e = 30
self.r = 40
a = MyClass(10,20)
dct = {'q': 100, 'w': 200, 'e': 300, 'r': 400}
print('before:', tmp.q, tmp.w, tmp.e, tmp.r)
for i in dct:
#do sth here
print('after:', tmp.q, tmp.w, tmp.e, tmp.r)
before: 10 20 30 40
after: 100 200 300 400