Skip to content

Instantly share code, notes, and snippets.

@kunimi
Created May 15, 2015 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunimi/8afd48b33e7a2b6f0fd0 to your computer and use it in GitHub Desktop.
Save kunimi/8afd48b33e7a2b6f0fd0 to your computer and use it in GitHub Desktop.
Singleton Python
class Singleton(object):
def __new__(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(Singleton, cls).__new__(cls)
return cls.instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment