Access by the interpreter prevents array resizing.

Yes, one can use the function, in place of the method but this appears 
to require copying the whole array.

If one sets b= a, then that reference can be deleted with del b.

Is there any similar technique for the interpreter?

Colin W.

Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> from numpy import *
 >>> a= array(7*[3])
 >>> a.resize((3,7))
 >>> a
array([[3, 3, 3, 3, 3, 3, 3],
       [0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0]])
 >>> a.resize((4,7))
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
 >>>

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to