All Questions
3 questions
1
vote
3
answers
988
views
Storing multiple instances on a Singleton?
RefactoringGuru's example Singleton in Python has an _instances dictionary field
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls....
4
votes
2
answers
4k
views
What's wrong with using a Singleton?
I'm working on a Python application in which there are two Singleton classes: App and Configuration.
The former seems straight forward, only ever instantiate one App instance; the latter seems ...
5
votes
1
answer
12k
views
Using singletons in Python (Django)
I was suggested to define a singleton in Python in the following way:
class Controller:
pass
# ...
controller = Controller()
However, this way, controller cannot be replaced with a derived ...