Created
April 28, 2018 05:41
-
-
Save kenzhaoyihui/5bd723dc65a10c06875d69d1391b3ddd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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