[Numpy-discussion] when does numpy create temporaries ?
Simon Burton
simon at arrowtheory.com
Mon May 29 23:56:00 EDT 2006
Consider these two operations:
>>> a=numpy.empty( 1024 )
>>> b=numpy.empty( 1024 )
>>> a[1:] = b[:-1]
>>> a[1:] = a[:-1]
>>>
It seems that in the second operation
we need to copy the view a[:-1]
but in the first operation we don't need
to copy b[:-1].
How does numpy detect this, or does it
always copy the source when assigning to a slice ?
I've poked around the (numpy) code a bit and
tried some benchmarks, but it's still not so
clear to me.
Simon.
--
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com
More information about the NumPy-Discussion
mailing list