Raymond Hettinger added the comment:

> It is certainly possible to document DivisionImpossible etc.

This should not be done.  We've made strong efforts to not extend the Decimal 
Arithmetic Specification.

Also, the API already suffers from high complexity.  Adding more exceptions to 
the mix just makes the module harder to learn.

Instead, you are welcome to add more specific text messages to the existing 
(and standards compliant) exceptions:

   raise InvalidOperation("Not enough precision to compute the answer.")

> I found it surprising at first, but like I said, it's like 
> the computer is given the first 28 digits of a number and 
> then asked to figure out the 30th digit.

People are always surprised when their mental model conflicts with the actual 
design model.  That doesn't mean the implementation should change.

There may be a documentation issue, but then again, people who are "surprised" 
usually haven't studied the docs in detail.

My overall sense for this bug report is that there isn't a real problem that 
needs to be solved.  AFAICT, this particular "confusion" has never arisen 
before (i.e. bug reports, questions in python classes, posts on stackoverlow, 
blog posts, etc).  Likewise, the issue does not seem to have ever arisen in the 
many other non-Python implementations of the decimal spec.

I recommend that this either be closed or be limited to tweaking some of the 
error messages for existing exceptions.

----------
nosy: +facundobatista, rhettinger, tim.peters
priority: normal -> low
versions: +Python 3.5 -Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21227>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to