On Saturday, 25 January 2014 03:49:11 UTC-5, Ivar Nesje wrote: > > It is nice that you raise this issue. I think most of the others working > with Julia has experience from C or Python which also have the same > semantics. I'll make an attempt to sum up how things work in this case. >
Julia doesn't have the same semantics as Python here, if that's what you're saying. In Python, += is an operation that types can implement separately from +, and is usually implemented in-place. Here's a NumPy example, because NumPy arrays are closest to Julia arrays, and += on plain old lists is Julia's "append!" instead: >>> a = np.array([1, 2, 3]) >>> b = a >>> a += 1 >>> b array([2, 3, 4])