[Numpy-discussion] MATLAB to Numpy

Andrei Berceanu berceanu at runbox.com
Fri Oct 27 17:25:26 EDT 2017

So how can I mutate all of them at once?

On Fri, 27 Oct 2017 09:26:06 -0700, Robert Kern <robert.kern at gmail.com> wrote:

> On Fri, Oct 27, 2017 at 9:16 AM, Benjamin Root <ben.v.root at gmail.com> wrote:
> >
> > In what way does it not work? Does it error out at the `arr = arr[mask]`
> step? Or is it that something unexpected happens?
> >
> > I am guessing that you are trying to mutate the px, py, pz, w, x, y, z
> arrays? If so, that for-loop won't do it. In python, a plain simple
> assignment merely makes the variable point to a different object. It
> doesn't mutate the object itself.
> More specifically, it makes the name on the left-hand side point to the
> object that's evaluated by the right-hand side. So this for loop is just
> re-assigning objects to the name "arr". The names "px", "py", etc. are not
> being reassigned. Here is a good article on how Python assignment works:
> https://nedbatchelder.com/text/names.html
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list