Help on sys.getrefcount
Christoph Becker-Freyseng
webmaster at beyond-thoughts.com
Thu Mar 6 11:08:28 EST 2003
Michael Hudson wrote:
> Christoph Becker-Freyseng <christoph at mmc-startup.com> writes:
>
>
>>I don't see why the refcount is so high (7 or 8 instead 3).
>
>
> One character strings are cached.
>
Interresting :-)
> Also, interning.
>
That's an other point I didn't think about when I wrote this test-program.
So when I use "multicharacter" string I still have a refcount of 6 but
that's fine with interning.
> Basically, don't worry about it for immutable objects. If you try
> lists or something, you'll see results closer to what you expect.
>
Yes using e.g. a lambda-function or a non-string and non-number object
refcount is 3.
Thank You very much,
Christoph Becker-Freyseng
More information about the Python-list
mailing list