GC中的python:这会有什么作用?

Bin*_*hen 1 python

一个python类A:

a = A()
array.append(a)
Run Code Online (Sandbox Code Playgroud)

...某些操作会触发方法b()

in a.b():

array.remove(self);
# will this make the self be freed? as the only reference has been removed from array.
# access the a's data...
Run Code Online (Sandbox Code Playgroud)

Ano*_*on. 5

当该方法正在执行时,您仍然有一个reference(self)a.

只有方法完成后才有a资格收集.