zunlatex at hotmail.com
Wed Mar 12 10:03:31 CET 2003
I'm defining 2 clases. They are like a matrix anda a vector. The
is a square one using list insie list [[1,2],[3,4]] and the vector is
a list [5,6].
I want to be able to write things like that
matrix * 2
How can i overload __mul__ for matrix in two ways depending if the
other elemetn is a number or a vecotr? and in wich class have i to
overload __mul__ to get vector * matrix and matrix * vector; in the
vector class? in the matrix class? in both?
thanks in advance
More information about the Python-list