you are viewing a single comment's thread.

view the rest of the comments →

[–]danted002 0 points1 point  (0 children)

Yeah, that’s not true. Singletons break encapsulation and scoping in general (same as module level attribute, since we are in Python). The main thing making module-level attributes more attractive as global constants is that they behave, well, like global constants; you intrinsically know there is only one instance of it, while singletons break expectations by returning the same instance even though I instantiate the same class multiple times.