A newbie question
wang frank
fw3 at hotmail.co.jp
Mon May 21 19:04:06 EDT 2007
Hi,
I am trying to write a python class with a new data type such as:
class Cc14:
def __init__(self, realpart, imagpart):
self.r=realart
self.i=imagpart
def __add__(self,x):
return self.r+x,r, self.i+x.i
If I have
x=Cc14(4,5)
y=Cc14(4,5)
z=x+y
z will be a tuple instead of Cc14. How can I return a Cc14 class?
Thanks
Frank
_________________________________________________________________
ウェブページを印刷しても途切れない!便利なブラウザ MSN版IE7 を使おう
http://promotion.msn.co.jp/ie7/
More information about the Python-list
mailing list