Re: Problem with operator overloading and inheritance in Python

2006-09-18 Thread Calvin Spealman
do I define new-style classes? > > - Edward > > > Original Message Follows > From: "Calvin Spealman" <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: "Edward Waugh" <[EMAIL PROTECTED]> > Subject: Re: Problem with operator over

Re: Problem with operator overloading and inheritance in Python

2006-09-17 Thread Calvin Spealman
On 9/17/06, Edward A. Waugh <[EMAIL PROTECTED]> wrote: > > > > > Consider the following code: > > import sys > > class FirstClass: > def __init__(self, value): > self.data = value > def __add__(self, value): > return FirstClass(self.data + value) > def display(self): >

Problem with operator overloading and inheritance in Python

2006-09-17 Thread Edward A. Waugh
Consider the following code:   import sys   class FirstClass:    def __init__(self, value):    self.data = "">    def __add__(self, value):    return FirstClass(self.data + value)    def display(self):    print self.data   class SecondClass(FirstClass):    def __add__(self,