Re: Question about overloading of binary operators

2008-03-31 Thread Dan Bishop
On Mar 31, 5:03 pm, gigs <[EMAIL PROTECTED]> wrote: > Raj Bandyopadhyay wrote: > > Hi > > > Here's a simple class example I've defined > > > # > > class myInt(int): > >def __add__(self,other): > > return 0 > > > print 5 + myInt(4) #prints 9 > > print myInt(4)

Re: Question about overloading of binary operators

2008-03-31 Thread gigs
Raj Bandyopadhyay wrote: > Hi > > Here's a simple class example I've defined > > # > class myInt(int): >def __add__(self,other): > return 0 > > print 5 + myInt(4) #prints 9 > print myInt(4) + 5 #prints 0 > # > > The Python bi

Question about overloading of binary operators

2008-03-31 Thread Raj Bandyopadhyay
Hi Here's a simple class example I've defined # class myInt(int): def __add__(self,other): return 0 print 5 + myInt(4) #prints 9 print myInt(4) + 5 #prints 0 # The Python binary operation function (binary_op1() in Objects/a