You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- import gc
-
- class FooClass:
- def __init__(self):
- self.value = 1
- def __del__(self):
- print(f"FooClass {id(self)} destroyed!")
-
- foo1 = FooClass()
- foo2 = foo1
- del foo1
- print("Called del foo1")
- gc.collect()
- foo2.value += 1
- print("Called foo2.value += 1")
|