[Numpy-discussion] memory allocation at assignment

Pierre Haessig pierre.haessig at crans.org
Thu Jun 28 02:20:00 EDT 2012

Le 28/06/2012 02:34, Nathaniel Smith a écrit :
> Yes it does. If you want to avoid this extra copy, and have a
> pre-existing output array, you can do:
> np.add(a, b, out=c)
And is there a temporary copy when using inplace operators like:

c = a.copy()
c += b

Is there a temporary (c+b)  array which is then assigned to c, or is it
really an inplace assignment as the operator +=  would suggest ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120628/96517d5f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120628/96517d5f/attachment.sig>

More information about the NumPy-Discussion mailing list