Reference counts

Bruce Sass bsass at freenet.edmonton.ab.ca
Thu May 24 04:17:43 EDT 2001


<...>
> However, the problem with that is that getrefcount() for any negative
> integer returns 1!
>
> >>> sys.getrefcount(-2)
> 1
>
> Any thoughts?

There is no "-2" object.
It is a "-" operator, and an object called "2".

Since the refcount is _always_ 1, we are probably seeing the refcount
ofa temporary instance of something.


- Bruce





More information about the Python-list mailing list