[Numpy-discussion] Confusion regarding Numeric array resizing

Jp Calderone exarkun at divmod.com
Thu Aug 26 19:20:05 EDT 2004

   I'm confused by the restriction on resizing arrays demonstrated below:

 >>> from Numeric import array
 >>> a = array([0])
 >>> a.resize((2,))
 >>> b = a
 >>> a.resize((3,))
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ValueError: cannot resize an array that has been referenced or is 
referencing another array in this way.  Use the resize function.
 >>> del b
 >>> a.resize((3,))
 >>> a
array([0, 0, 0])

   This seems like an unnecessary restriction.  Is there a reason I'm 
missing for it to be in place?


More information about the NumPy-Discussion mailing list