Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16 单例模式__new__方式实现 #52

Open
sniperXue opened this issue Apr 2, 2018 · 0 comments
Open

16 单例模式__new__方式实现 #52

sniperXue opened this issue Apr 2, 2018 · 0 comments

Comments

@sniperXue
Copy link

class Singleton(object):
__instance = None

     def __new__(cls, *args, **kwargs):
               if not cls.__instance:
                     cls.__instance = object.__new__(cls)
               return cls.__instance

自己写的单例模式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant