Decimals and other numbers

Ben Finney ben+python at
Fri Jan 9 03:43:04 CET 2015

Devin Jeanpierre <jeanpierreda at> writes:

> decimal.InvalidOperation: 0 ** 0
> I'd file a bug report but I'm anticipating some rational (heh)
> explanation. Any ideas?

First note that it's explicitly documented as an invalid operation
So someone has at least thought about it and deliberately decided it
should be so.

Why that should be, I don't know; I think the correct behaviour is for
‘0 ** 0 == 1’. But perhaps someone else has a better explanation for why
Decimal should behave differently from ‘int’ and ‘float’ here.

 \      “I bought a self learning record to learn Spanish. I turned it |
  `\        on and went to sleep; the record got stuck. The next day I |
_o__)                   could only stutter in Spanish.” —Steven Wright |
Ben Finney

More information about the Python-list mailing list