[Numpy-discussion] array shift and |=, copy, and backward operations

Perry Greenfield perry at stsci.edu
Fri Feb 10 12:55:01 EST 2006


On Feb 10, 2006, at 3:45 PM, Nico wrote:
>
> I finally noticed that
>
> a = array([0,1,0,0])
> a[1:] |= a[:-1] | False
>
> also works, but I can't figure out why...
>
Because the expression on the right generates a new copy, thus 
eliminating the problem of overwriting itself.





More information about the NumPy-Discussion mailing list