python 对象管理

**class User:
    def __new__(cls, *args, **kwargs):
      print("this is new method=====")
      instance=object.__new__(User)
      return instance

    def __init__(self,name,age):
        self.name=name
        self.age=age
    print("this is init methond==========")
User("zhangsan",18)**

python 对象管理
python 对象管理
关于is 与等号
等号判断内容是否相同
is判定内存是否相同
eg
a=1
b=1
ab
a is b
结果都是Ture
a=1
b=1.0
a
b
a is b
结果:
a==b 是Ture
a is b 是 False

相关文章: