# [PYTHON MATRIX-SIG] Re: may be a bug

**Perry A. Stoll
**
pas@lems.brown.edu

*Mon, 24 Jun 1996 14:52:32 -0400 (EDT)*

I know of one thing that can hold references. In the interpreter, you can
reference the last value returned by using an underscore.
For example:
>>>* x = 1
*>>>* x
*1
>>>* z = _
*>>>* z
*1
So that should account for the drop in refcount from 5 to 4 in your
example and probably why you found the problem in ArrayPrinter.py.
I haven't read the documentation too recently, but I don't recall seeing
this - is this documented? How did I find it? just lucky.
-Perry
<pas@lems.brown.edu>
On Fri, 21 Jun 1996, Tser-Yuan (Brian) Yang wrote:
>* Brian Yang wrote:
*>*
*>* > The following may have been posted or even corrected. If so, I apologize
*>* > for sending junk mail.
*>*
*>* > >>> from Numeric import *
*>* > >>> a=array((1,2))
*>* > >>> import sys
*>* > >>> sys.getrefcount(a)
*>* > 2
*>* > >>> a
*>* > 1 2
*>* > >>> sys.getrefcount(a)
*>* > 5
*>* > >>> b=1
*>* > >>> sys.getrefcount(a)
*>* > 4
*>*
*>* Some experiment showed that the extra reference counts are held by
*>* something in ArrayPrinter.py, because I commented out the following line
*>* in numeric.py:
*>*
*
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================