NotImplemented used in Decimal
steve at REMOVE-THIS-cybersource.com.au
Sat Apr 24 11:56:35 CEST 2010
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 interpreter will fall back by calling the reflected
> method of the other operand.
I knew that works with comparisons __eq__ etc, but somehow I had a mental
blank about arithmetic operators! Yes, you're right, and the docs say so
explicitly. Somehow I had convinced myself that NotImplemented only
worked with comparisons.
More information about the Python-list