Setting default/empty attributes for user classes in __init__

I think you should avoid both solutions. Simply because you should avoid to create uninitialized or partially initialized objects, except in one case I will outline later. Look at two slightly modified version of your class, with a setter and a getter: class MyClass1: def __init__(self, df): self.df = df self.results = None def set_results(self, … Read more

How do I avoid the “self.x = x; self.y = y; self.z = z” pattern in __init__?

Disclaimer: It seems that several people are concerned about presenting this solution, so I will provide a very clear disclaimer. You should not use this solution. I only provide it as information, so you know that the language is capable of this. The rest of the answer is just showing language capabilities, not endorsing using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)