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

John Machin sjmachin at lexicon.net
Mon Jul 30 20:26:00 EDT 2007


On Jul 31, 9:31 am, Zentrader <zentrad... at gmail.com> wrote:
> > from decimal import Decimal
>
> > In [21]: a = Decimal()
>
> > In [22]: class Decimal(object):
> >    ....:     pass
> >    ....:
>
> > In [23]: b = Decimal()
>
> > In [24]: a - b
>
> Perhaps I don't understand what you are doing here, but on line 22 you
> overload Decimal.

In the utter absence of any clues from the OP, Marc was demonstrating
one possible way that the puzzling [Can't subtract one Decimal
instance from another???] error message could have been caused.





More information about the Python-list mailing list