[Numpy-discussion] Re: Correction -- optional arguments to the array constructor

Philip Austin paustin at eos.ubc.ca
Wed Jul 7 13:17:03 EDT 2004


Oops, note the change below at --->

Todd Miller writes:
 > 
 > OK,  I think I see what you're after and agree that it's a bug.  Here's
 > how I'll change the behavior:
 > 
 > >>> import numarray
 > >>> a = numarray.arange(10)
 > >>> b = numarray.array(a, copy=0)
 > >>> a is b
 > True
 > >>> b = numarray.array(a, copy=1)
 > >>> a is b
 > False

Just to be clear -- the above is the current numarray v1.0 behavior
(at least on my machine).  Numeric compatibility would additonally
require that

import numarray
a = numarray.arange(10)
theTypeCode=repr(a.type())
b = numarray.array(a, theTypeCode, copy=0)
print a is b
b = numarray.array(a, copy=1)
print a is b

produce

True
False

While currently it produces

--->

False
False

Having said this, I can work around this difference -- so either
a note in the documentation or just removing the copy flag from 
numarray.array would also be ok.

-- Thanks, Phil





More information about the NumPy-Discussion mailing list