AdvancePython
latest
第一章:导论
第二章:Python 一切皆对象
第三章:魔法函数
第四章:深入类和对象
第五章:自定义序列类
第六章:深入Python的set和dict
第七章:对象引用、可变性和垃圾回收
7.1 python 的变量是什么
7.2 is 和 == 区别
7.3 del 语句和垃圾回收
7.4 一个经典的参数错误
7.5 本章小结
第八章:元类编程
第九章:迭代器和生成器
关于作者
Roadmap
AdvancePython
Docs
»
第七章:对象引用、可变性和垃圾回收
»
7.3 del 语句和垃圾回收
Edit on GitHub
7.3 del 语句和垃圾回收
¶
# python 中垃圾回收算法为 引用计数
a
=
1
b
=
a
del
a
del 触发 __del__ 逻辑
对象引用计数为 0 时,会被垃圾回收
Read the Docs
v: latest
Versions
latest
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds
Free document hosting provided by
Read the Docs
.