Getting the reference count

John Grayson johngrayson at home.com
Sun Aug 27 16:58:12 EDT 2000


In article <8obtim$1a5$1 at news5.svr.pol.co.uk>,
  "Makhno" <mak at imakhno.freeserve.co.uk> wrote:
> >> Is it possible to get the reference count of a PyObject* object?
> >> I'm sure it must be, but I can't see it documented anywhere.
> >>
> >> Something similar to Perl's SvREFCNT() Macro would be great.
> >
> >sys.getrefcount(object)
>
> I'm sure there must be a better way than messing about importing
modules and
> deferencing attributes.
> Presumably the reference count is stored inside the PyObject struct?
>
>

Just just gave you the answer.

If you're so sure there is a better answer, pray what is it?
Remember, Pythonistas are *always* messing about
importing modules, but we *never* think about dereferencing
attributes...


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list