[docs] [issue21227] Decimal class error messages for integer division aren't good

Stefan Krah report at bugs.python.org
Thu Apr 17 01:17:35 CEST 2014


Stefan Krah added the comment:

The idea behind the list as the exception message is this:  If multiple
conditions would have raised the signal they are all listed, while the
"highest ranking" signal is the one that is ultimately raised.

>>> from decimal import *
>>> c = getcontext()
>>> for v in c.traps:
...     c.traps[v] = True
... 
>>> 
>>> Decimal(8) ** 1000000000000000
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
decimal.Overflow: [<class 'decimal.Overflow'>, <class 'decimal.Inexact'>, <class 'decimal.Rounded'>]

Exception precedence is listed here at the bottom of the page:

http://speleotrove.com/decimal/daexcep.html

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21227>
_______________________________________


More information about the docs mailing list