code

# Reference counting adopted by Python garbage collection

Object () = 1
a = object(a)# object() = 2
b = a

Object ()
del a
print(a)    # NameError: name 'a' is not defined
Collect once, count minus one
print(b)    # <object object at 0x0000013BFFC84BA0>

class A:
    def __del__(self) :
        """ There are things you can do here when an object is recycled. ""
        pass
Copy the code

The last

Have a basic concept, have met this question before the interview ~ ~ ~, down much also check other resources c.biancheng.net/view/5540.h…