[Tutor] When is = a copy and when is it an alias

Denis Heidtmann denis.heidtmann at gmail.com
Mon Jan 27 07:16:25 CET 2014


Running python 2.7 in linux

Below are two extremes.  Can I get some guidance on this?

Thanks,
-Denis H

>>> a=zeros((2,3),dtype=int)
>>> b=a
>>> a[:,0]=[1,2]
>>> a
array([[1, 0, 0],
       [2, 0, 0]])
>>> b
array([[1, 0, 0],
       [2, 0, 0]])
>>> a=2
>>> a
2
>>> b
array([[1, 0, 0],
       [2, 0, 0]])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140126/03921470/attachment.html>


More information about the Tutor mailing list