Steve D'Aprano wrote:
> Is there a way to log when the garbage collector finds and collects a
> reference cycle?
>
> I don't care about objects claimed by the reference counter, I only care
> about cycles.
I don't know, and I don't think so. Would a structure like
a --- b --- c
| | |
d
Amit Dev wrote:
> The object is not garbage collected, since there appears to be a cycle
> (between method m2 and A). I would expect this to behave the same as
> having another method "def m2(self): self.m1()", but unfortunately its
> not.
> In above case m2 seems to be in a.__dict__ which is cau
Amit Dev wrote:
> Simple question. If I have the following code:
>
> class A:
> def __init__(self, s):
> self.s = s
> self.m2 = m1
>
> def m1(self):
> pass
>
> if __name__ == '__main__':
> a = A("ads")
> a.m1()
> a = None
>
> The object is not garbag