I am wondering what is the best way to make two-dimensional
array. I guess for a sparse array, a dictionary indexed by a
tuple is very natural, e.g:
arr = {}
arr[(56,93)] = "hello"
But for a non-sparse array, am I better off using a list of
lists, like this:
arr[56][93] = "hello"
The problem here is you have to completely initialize it,
or it will bomb if you attempt to access an uninitialized element.
Is there an elegant way to create a list containing N copies of
one object?
If you have to pass such an array to procedures, will you
have a lot of copying overhead?
While I'm at it, is there a elegant way to remove the first
element of a list? E.g.:
xxx = [4,2,8,5,9]
yyy = read(xxx)
print xxx
[2,8,5,9]
print yyy
4
If there are any documents (besides the Tutorial and the FAQ) that
answer these sort of questions, please let me know.
Thanks a lot!
-------------------------------------------------------------------
Send money to:
Doug Braun Intel Israel, Ltd. M/S: IDC-42
Tel: 011-972-4-655069 dbraun@inside.intel.com