gerrit at nl.linux.org
Wed Oct 18 14:31:27 CEST 2006
On 2006-10-18 14:15:17 +0200, Sssasss wrote:
> Fredrik Lundh wrote:
> > "Sssasss" wrote:
> > > I wan't to multiply two square matrixes, and i don't understand why it
> > > doesn't work.
> > >
> > > def multmat(A,B):
> > > "A*B"
> > > if len(A)!=len(B): return "error"
> > > D=
> > > C=
> > > for i in range(len(A)): D.append(0)
> > > for i in range(len(A)): C.append(D)
> > append doesn't copy data, so you're basically adding len(A) references to
> > the same D list to C. for more on this, see:
> > http://pyfaq.infogami.com/how-do-i-create-a-multidimensional-list
> > </F>
> Ok!! Tank you very much, i understand now.
You might also want to look at numpy/numarray.
More information about the Python-list