Skip to content

Instantly share code, notes, and snippets.

@dmiro
Created March 9, 2018 08:11
Show Gist options
  • Save dmiro/a95549e07876e4fdf62d27422ff2f581 to your computer and use it in GitHub Desktop.
Save dmiro/a95549e07876e4fdf62d27422ff2f581 to your computer and use it in GitHub Desktop.
singleton class
class Singleton(object):
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = object.__new__(cls, *args, **kwargs)
return cls._instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment