I thought it was a self contained snippet ;-) Here's another attempt that shows "_" is the cause of my confusion.
import numpy as np x = np.eye(3) x array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) x.resize((5,5)) 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 _ array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]])
Thanks for the help,
Scott
2009/1/13 Stéfan van der Walt
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
: # 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)
Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion