Mailing List Archive

ref counting, access from python
Hello.
How can i get objects current ref count from my python code?
Thanks.
--
====================
Oleg Orlov
orlov@diasoft.ru
ref counting, access from python [ In reply to ]
Oleg Orlov wrote:
>
> Hello.
> How can i get objects current ref count from my python code?
> Thanks.

>>> import sys
>>> sys.getrefcount(None)
1583
>>> print "ciao - chris"
ciao - chris
>>>

--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
ref counting, access from python [ In reply to ]
Christian Tismer <tismer@appliedbiometrics.com> wrote:

: Oleg Orlov wrote:
:>
:> Hello.
:> How can i get objects current ref count from my python code?
:> Thanks.

:>>> import sys
:>>> sys.getrefcount(None)
: 1583
:>>> print "ciao - chris"
: ciao - chris
:>>>

Wow, 1583 seems a little high to me. ;)

Python 1.5.2 (#14, Jun 11 1999, 16:31:09) [C] on aix4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> sys.getrefcount(None)
140
>>>

Anyone wonder what chris has been doing? ;)

-Arcege
ref counting, access from python [ In reply to ]
"Michael P. Reilly" wrote:
>
> Christian Tismer <tismer@appliedbiometrics.com> wrote:
>
> : Oleg Orlov wrote:
> :>
> :> Hello.
> :> How can i get objects current ref count from my python code?
> :> Thanks.
>
> :>>> import sys
> :>>> sys.getrefcount(None)
> : 1583
> :>>> print "ciao - chris"
> : ciao - chris
> :>>>
>
> Wow, 1583 seems a little high to me. ;)

This was from PythonWin.
If you want to see real weirdness, try IDLE.
Every time you create a window, the number increases.

> Python 1.5.2 (#14, Jun 11 1999, 16:31:09) [C] on aix4
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import sys
> >>> sys.getrefcount(None)
> 140

This is slightly platform dependant.
Under Win98, I get 164 (both with standard and stackless Python).

> Anyone wonder what chris has been doing? ;)

:-) what I do all day - ciao - chris

--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
not reilly, oh really
ref counting, access from python [ In reply to ]
On Thu, 17 Jun 1999 14:15:56 GMT, Michael P. Reilly <arcege@shore.net> wrote:
>Christian Tismer <tismer@appliedbiometrics.com> wrote:
>:>>> import sys
>:>>> sys.getrefcount(None)
>: 1583
>:>>> print "ciao - chris"
>: ciao - chris
>:>>>
>Wow, 1583 seems a little high to me. ;)
>Anyone wonder what chris has been doing? ;)

A whole lotta nothin'?

Later,
Blake.

--
One Will. One Dream. One Truth. One Destiny. One Love.