(python)__new__方法实现单例,__new__常用途径

__new__主要用于继承一些不可变的class,如int,str,tuple,提供一个自定义这些类实例化的过程,

执行结果

猜你喜欢

转载自blog.csdn.net/houmenghu/article/details/84629628