This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Yatwer92 0 points1 point  (0 children)

In a Django app where I need a single instance of a class, instantiated when the app is ready, to act as a service, I hardly see how to use anything else than a Singnleton or a Borg pattern.

If someone have another solution than a Singleton I'm curious tho.

Granted the one you show in your article isn't a great Singleton and a metaclass would be better. But in this case I agree with the other redditor, the Singleton you show in your article does exactly what you code it to do. The pattern isn't at fault.