Newbie: Classes
Bjorn Pettersen
bjorn.pettersen at comcast.net
Mon Oct 27 02:18:43 EST 2003
keflimarcusx at aol.comNOSPAM (KefX) wrote in
news:20031027020704.27688.00000199 at mb-m04.aol.com:
>>Yeah, that's right. Do it like this instead:
>>def __mul__(self, m):
>> r *= m
>> i *= m
>> return Complex(r, m)
>
> err...I meant this for the last line:
> return Complex(r, i)
it's late, but I think you meant
def __mul__(self, m):
r = self.r * m
i = self.i * m
return Complex(r, i)
-- bjorn
More information about the Python-list
mailing list