mathias-usenet at valpo.de
Wed Mar 12 10:56:51 CET 2003
zunlatex at hotmail.com (zunbeltz) wrote:
> I want to be able to write things like that
> matrix * 2
> vector *2
> but also
> How can i overload __mul__ for matrix in two ways depending if the
> other elemetn is a number or a vecotr?
This doesn't work. But you can test the type of the argument of the __mul__
method and call different operations.
> 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?
More information about the Python-list