👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
I have Python classes, of which I need only one instance at runtime, so it would be sufficient to have the attributes only once per class and not per instance. If there would be more than one instance (which won"t happen), all instance should have the same configuration. I wonder which of the following options would be better or more "idiomatic" Python.
class MyController(Controller): path = "something/" children = [AController, BController] def action(self, request): pass
class MyController(Controller): def __init__(self): self.path = "something/" self.children = [AController, BController] def action(self, request): pass
👻 Read also: what is the best laptop for engineering students?