[Numpy-discussion] ndarray.resize method and reference counting

Stéfan van der Walt stefan at sun.ac.za
Tue Jan 13 08:24:27 EST 2009


Hi Scott

I can't reproduce the problem below.  Would you please send a
self-contained snippet?

Note that, in Python, "_" is a special variable that always points to
the last result.  In IPython there are several others.

Cheers
Stéfan

2009/1/13 Scott Sinclair <scott.sinclair.za at gmail.com>:
> # I don't expect this
>>>> x = np.eye(3)
>>>> x
> array([[ 1.,  0.,  0.],
>       [ 0.,  1.,  0.],
>       [ 0.,  0.,  1.]])
>>>> x.resize((5,5), refcheck=True)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ValueError: cannot resize an array that has been referenced or is referencing
> another array in this way.  Use the resize function
>>>> x.resize((5,5), refcheck=False)



More information about the NumPy-Discussion mailing list