Skip to content

Instantly share code, notes, and snippets.

@kenzhaoyihui
Created April 28, 2018 05:41
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 kenzhaoyihui/5bd723dc65a10c06875d69d1391b3ddd to your computer and use it in GitHub Desktop.
Save kenzhaoyihui/5bd723dc65a10c06875d69d1391b3ddd to your computer and use it in GitHub Desktop.
class Singleton(object):
def __new__(cls):
_instance = None
if not hasattr(cls, '_instance'):
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwarg)
return cls._instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment