[Python-Dev] NotImplemented reaching top-level

Facundo Batista facundobatista at gmail.com
Sat Dec 24 18:31:19 CET 2005


Folks,

There's a bug about number coercion about Decimal
(http://www.python.org/sf/1355842).

The bug appeared after some changes Raymond and I did a few months
ago, solving something else (started to return NotImplemented instead
of raising TypeError, to better work with custom objects that
implements type coercion from Decimal).

The point is that I'm really astonished about the following behaviour,
and don't know where to start searching:

>>> d
Decimal("1")   # using decimal.py rev. 39328 from svn
>>> d + 1.2
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for +:
'Decimal' and
'float'
>>> d += 1.2
>>> d
NotImplemented
>>>

Thanks for any tip.

.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list