单例模式(python)

python 的单例模式需要重写__new__()和 __init__()


需要注意,标识符__和_区别

参考资料:

https://www.cnblogs.com/huchong/p/8244279.html
https://www.cnblogs.com/tangkaishou/p/9246353.html
https://blog.csdn.net/qq_43439853/article/details/99584193
https://cloud.tencent.com/developer/article/1582867
https://docs.python.org/zh-cn/3/tutorial/classes.html#private-variables



来自为知笔记(Wiz)


posted on 2020-12-20 00:32  白衣风云  阅读(61)  评论(0编辑  收藏  举报

导航