leewz added the comment:
Total list of issues now:
- Error message for `DivisionImpossible` is
[<class 'decimal.DivisionImpossible'>]
instead of an actual error message.
- `decimal.DivisionImpossible.__doc__` is empty.
- Calling `help(decimal.DivisionImpossible)` turns up nothing useful.
I checked all of these just now on my 3.2.3 (Windows). These issues are a
CHANGE from 3.2 to 3.3. For example:
- Old error:
decimal.InvalidOperation: quotient too large in //, % or divmod
- New error:
InvalidOperation: [<class 'decimal.DivisionImpossible'>]
I assume that the issues also apply to the other InvalidOperation types. So I
guess what I'm really asking for is to pull forward the 3.2 docs and messages.
> That doesn't mean the implementation should change.
Er, I was explaining why it wasn't really surprising once I thought about it.
> There may be a documentation issue, but then again, people who are
> "surprised" usually haven't studied the docs in detail.
To clarify:
- I looked at the Decimal docs
- skimmed for references to modulo and division
- looked for `DivisionImpossible`
- Then looked on Google for '"DivisionImpossible" Python'.
- Experimented with changing precision and fooling around with bigger and
smaller numbers, and realized why the operation was logically impossible.
- Came here, posted, got a response that it was a flag raised by libmpdec.
I'm not asking for a change in behavior. I did point out that it was
inconsistent with regular floats, in case consistency with Pyfloats was a thing
that mattered. But I don't care about that. I only worry about anyone else who
would use Decimal coming across the same unhelpful error.
> 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 agree it'd be (very) rare, but part of the reason why it might not appear
online is that the issues at the top of this email are relatively new (3.3).
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21227>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com