>> But i don't think this is a good way to write a singleton, because >> then the user of the class has to get instances by saying "MyClass" >> instead of "MyClass()". Phillip> That's a stylistic decision. IMO, it's more pythonic to *not* Phillip> call a constructor. One does not, after all, call modules in Phillip> order to "construct" them, and modules are a prime example of Phillip> singletons in Python. I think Ping's point is that if the user thinks Foo is a class, he's going to want to instantiate it like Foo(). Whether or not you get back a new instance or an existing one is sort of beside the point. It's simply a consistency issue. Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4