On 29-Oct-08, at 3:43 PM, Robert Kern wrote:

> Eh, that's not entirely true.
>
>  x = 1
>  x += 2
>
> That's not in-place. They are called "augmented assignments", not
> "in-place operations" for this reason. The defining characteristic is
> that "x <op>= y" should be equivalent to "x = x <op> y" except
> possibly for *optional* in-place semantics.

Indeed.

x = "foo"
x += "bar"

This definitely isn't in-place, since strings are immutable, but it  
works, and people expect it to work.

Of course it's worth mentioning in the docs somewhere that only the  
augmented assignments for element-wise ops are in-place (which should  
be obvious to anyone who knows what an outer product is).

David
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to