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

2009-01-31 Thread Jon Olav Vik
Scott Sinclair gmail.com> writes: > >>> 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 "", line 1, in > ValueError: cannot resize an array that has b

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

2009-01-13 Thread Scott Sinclair
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 "

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

2009-01-13 Thread 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 = n

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

2009-01-13 Thread Scott Sinclair
Hi, I'm confused by the following: >>> import numpy as np >>> np.__version__ '1.3.0.dev6116' # I expect this >>> x = np.eye(3) >>> x.resize((5,5)) >>> x = np.eye(3) >>> y = x >>> x.resize((5,5)) Traceback (most recent call last): File "", line 1, in ValueError: cannot resize an array that has