logo       

Confusion regarding Numeric array resizing: msg#00066

python.numeric.general

Subject: Confusion regarding Numeric array resizing


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?

Jp



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise