On 2005-01-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>>> l = [] >>>> for i in range(2): > for j in range(2): > l[i][j] = 'x' > > > > Traceback (most recent call last): > File "<pyshell#7>", line 3, in -toplevel- > l[i][j] = 'x' > IndexError: list index out of range > > So you still have to dimension the list before you can use it , eg like >>l = [] >>for i in range(2): >> l.append([]) >> for j in range(2): >> l[i].append(j) > > then you do not get the indexerror, but I feel a class is what you need > here to make life easier and the program more readable
I'd probably numeric python (which I beleive is depricated, but it's what I have installed) or numarray. I think either would make it a lot easier. Using lists of lists when what you want is a matrix can be made to work, but there are a lot of non-obvious traps to fall into. -- Grant Edwards grante Yow! I always wanted a at NOSE JOB!! visi.com -- http://mail.python.org/mailman/listinfo/python-list