List reference at offset

Colin.Hankins at touit.com Colin.Hankins at touit.com
Wed May 27 13:36:09 EDT 2009


Disclaimer: I'm learning python and would like to use it in a
project.

The project will have many large matricies. In one particular instance
I need to reference a smaller submatrix of the larger matrix. I don't
want to create a new copy or even change any of the values, I just
want to quickly and easily be able to look at this sub matrix.

So I am using lists of lists for the matricies (I am also playing with
NumPy) and is there anyway to create a pointer to an offset in a
list?

I know you can have A = B = [] which would be the same.

And I know I can simply do a B[x + offset to submatrix].

But I was hoping there may be a way to just have a pointer? Or is
there another more efficient method to do this in python?

Thanks!



More information about the Python-list mailing list