Can get reference of a part of a list?
Terry Reedy
tjreedy at udel.edu
Thu May 12 13:18:06 EDT 2005
"flyaflya" <flyaflya at gmail.com> wrote in message
news:d6020b$3a7$1 at news.yaako.com...
>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.
Look into Numerical Python or Numarray, where slices are views instead of
copies.
TJR
More information about the Python-list
mailing list