TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Jul 30 12:56:56 CEST 2007

On Mon, 30 Jul 2007 03:36:33 -0700, Gilbert Fine wrote:

> This is a very strange exception raised from somewhere in our program.
> I have no idea how this happen. And don't know how to reproduce. It
> just occurs from time to time.

Maybe different `Decimal`\s?  Here's how to reproduce such a traceback:

In [20]: from decimal import Decimal

In [21]: a = Decimal()

In [22]: class Decimal(object):
   ....:     pass

In [23]: b = Decimal()

In [24]: a - b
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/home/bj/<ipython console> in <module>()

<type 'exceptions.TypeError'>: unsupported operand type(s) for -: 'Decimal' and 'Decimal'

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list