On Thu, Jun 28, 2012 at 7:04 PM, Chris Barker <chris.bar...@noaa.gov> wrote: > On Thu, Jun 28, 2012 at 9:06 AM, Pierre Haessig > >> On the other hand, just like srean mentionned, I think I also misused >> the "c[:] = a+b" syntax. >> I feel it's a bit confusing since this way of writing the assignment >> really feels likes it happens inplace. Good to know it's not the case. > > well, c is being modified in place -- it's the a+b that is creating a new > array. > > so if you have a c around for another purpose (other than to store the > result of a+b -- it might make sense to use this approach. Though a > little faster might be: > > c[:] = a > c += b
That should be faster than c[:] = a + b, but still slower than np.add(a, b, out=c). -n _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion