+ 2

Is it more recommended to use class instead? (Using Python)

In a project I have many cases where I would need only one instance of a class. Is it more recommended to use the class instead of the 1 instance? Magic methods aren't playing big role. What are the pros or cons of using either of the 2 cases? : Case 1: Creating one instance with object methods and attributes. Case 2: Using the class with equivalent static methods and attributes.

18th Oct 2019, 1:40 PM
Seb TheS
Seb TheS - avatar
3 Réponses
+ 2
But you have several classes in your program? Or just one? (Because if it was only one or a few and you always only need 1 instances tops, maybe good old procedural style would be a better fit?)
18th Oct 2019, 4:53 PM
HonFu
HonFu - avatar
+ 1
HonFu A sentillion classes! More than 10.
18th Oct 2019, 5:29 PM
Seb TheS
Seb TheS - avatar
0
Hm, okay...
18th Oct 2019, 5:42 PM
HonFu
HonFu - avatar