Thanks a lot Fredrik and Tim for your help.
Cheers,
Mohit
--
http://mail.python.org/mailman/listinfo/python-list
> obj1 = c1(1)
>
> obj1 + 10 # this works just fine
>
10 + obj1 # throws exception
> Q. What do I have to do to make the following line work?
>
> 10 + obj1
http://docs.python.org/ref/numeric-types.html
You want to read the section on __radd__ (and it's o
Mohit Bhatt wrote:
> Hello,
>
> I just started out with python( couple of weeks).
>
> I have a query regarding Operator Overloading
>
> class c1:
> def __init__(self,value):
> self.data = value
> def __add__ (self,operand2):
>
Hello,
I just started out with python(
couple of weeks).
I have a query regarding Operator
Overloading
class c1:
def
__init__(self,value):
self.data
= "">
def
__add__ (self,operand2):
self.data
+= operand2