I am just learning python and I donโt know exactly what should be in __init__ . Usually I just see people writing self.arg = arg for each argument.
I just want to make sure I'm good at coding. Everything is fine if I have something like this:
def __init__(self, arg1): self.arg1 = arg1 self.var1 = 0 self.var2 = 0 self.var3 = 0 self.var4 = 0 self.var5 = None self.var6 = None self.initialize_vars()
The reason for this is that I need to call a couple of functions to initialize these values. I am not sure why, but it seemed to me wrong, and I did not see such examples, so I wanted to check whether this is good or not. If not, what can I do instead?
Also, is it bad to introduce self.var7, for example, in another function after __init__ ?
source share