Re: NotImplemented used in Decimal

2010-04-24 Thread Steven D'Aprano
On Fri, 23 Apr 2010 23:51:39 -0700, Chris Rebert wrote: > If the conversion to Decimal in _convert_other() fails, the operator > method returns NotImplemented to signal to the interpreter that Decimal > doesn't know how to do the requested operation with an operand of the > given type; the interp

Re: NotImplemented used in Decimal

2010-04-23 Thread Chris Rebert
On Fri, Apr 23, 2010 at 11:25 PM, Steven D'Aprano wrote: > On Sat, 24 Apr 2010 09:05:14 +0530, Kushal Kumaran wrote: >> On Sat, Apr 24, 2010 at 8:54 AM, Steven D'Aprano >> wrote: >>> I'm reading the source code for decimal.Decimal, and I see that the >>> arithmetic operations (__add__, __sub__, e

Re: NotImplemented used in Decimal

2010-04-23 Thread Steven D'Aprano
On Sat, 24 Apr 2010 09:05:14 +0530, Kushal Kumaran wrote: > On Sat, Apr 24, 2010 at 8:54 AM, Steven D'Aprano > wrote: >> I'm reading the source code for decimal.Decimal, and I see that the >> arithmetic operations (__add__, __sub__, etc.) start with code like >> this: >> >>        if other is Not

Re: NotImplemented used in Decimal

2010-04-23 Thread Kushal Kumaran
On Sat, Apr 24, 2010 at 8:54 AM, Steven D'Aprano wrote: > I'm reading the source code for decimal.Decimal, and I see that the > arithmetic operations (__add__, __sub__, etc.) start with code like this: > >        if other is NotImplemented: >            return other > > > I don't understand the pu

NotImplemented used in Decimal

2010-04-23 Thread Steven D'Aprano
I'm reading the source code for decimal.Decimal, and I see that the arithmetic operations (__add__, __sub__, etc.) start with code like this: if other is NotImplemented: return other I don't understand the purpose of this. I presume that it is *not* for the use-case of: d