numpy array assignment problem

后端 未结 2 908
说谎
说谎 2020-11-27 18:56

I have a strange problem in Python 2.6.5 with Numpy. I assign a numpy array, then equate a new variable to it. When I perform any operation to the new array, the original\'

2条回答
  •  天涯浪人
    2020-11-27 19:31

    Briefly, a variable assignment creates a new reference to the existing object.

      A = object   # A points to object in memory
      B = A        # B points to the same object
    

提交回复
热议问题