This is not really a support mailing list, it is intended for ideas about
modifying the python language or its libraries.

However after a quick look, the line tt = arr2 is not creating a copy of
array2. It creates a new name bound to the same underlying object, an alias
if you will. You will need to use some sort of copy function (such as
np.copy) if you want an independent array.

If you are interested in learning more, I suggest you look into how python
implements variables. The FAQ (
https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x)
has some info on this. There are other sources (Fluent Python book comes to
mind) that go into this in more detail.


-- 
Nate Lust, PhD.
Astrophysics Dept.
Princeton University
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/2D47UN2KQWUVA55IDCRXVQTHTOVXBW2K/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to