I have a python function func(A). A is a numpy.array and can be big such that I hesitate copying it over and over again. This func(A) wants to change the content of A. I know this a python newbie issue. I used to program in C and it could be done by pointers. How can I change the content of A so that the change is also valid outside the scope of the func(A)?
I have a python function func(A) . A is a numpy.array and can be
Share
The tl;dr is in your case, it basically already is. Unless you assign a new value to the label A in the method, A will be a reference to the object you passed, which means any modifications to A will change the original object everywhere else you use it.
ex: