[Tutor] operators

Aurelio Magalhaes Dias amd@atlas.ucpel.tche.br
Thu Mar 27 12:32:02 2003


On Thu, 27 Mar 2003, Isaac Hall wrote:

> Hi list,
>

Hi Isaac,

> Im wondering if anyone can tell me how to define an operator to work on
> multiple types.  In my case Im trying to construct a class for matricies
> and I would like to define matrix multiplication to either multiply 2
> matricies or to multiply a matrix by a scalar depending on what is given
> in the argument.  also, if someone can correct me if I am wrong, to
> redifine multiplication in a class, I must use:
> def __*__(self,a):
> =09blah
>
> right?
>

no, you should use

def __mult__(self,a):
=09blah

> anyway, any help would be hot
>
> thanks
>

Hope this helps !!!

Aur=E9lio.