Can get reference of a part of a list?

flyaflya flyaflya at gmail.com
Thu May 12 12:58:49 EDT 2005


I want make a 2-D array from a list,all elements is references of 
list's,like this:
a = [1,2,3,4]
b = [ [1,2], [3,4] ]
when change any elements of a, the elements of b will change too, so I 
can  use some function for list to change b.
c/c++ can work in this way,I think let b[0] = a[0:2], b[1] = a[2:3],but 
    it's not reference,it's copy.



More information about the Python-list mailing list