What does gc.get_objects() return?

Ian Kelly ian.g.kelly at gmail.com
Wed Mar 12 18:40:00 EDT 2014


On Wed, Mar 12, 2014 at 4:35 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> So not all optimizations are done that could be done.
>
> Or is it?
>
>>>> a = 1,2,3
>>>> gc.is_tracked(a)
> True
>>>> gc.collect()
> 0
>>>> gc.is_tracked(a)
> False

I guess the reason for this is that when PyTuple_New is called, it
knows how many elements it will contain but doesn't know yet what they
are, so it defers the issue by just going ahead and adding itself to
the GC



More information about the Python-list mailing list