[Python-ideas] Should decimal.InvalidOperation subclass ValueError?
Stefan Krah
stefan at bytereef.org
Sun May 22 11:27:34 EDT 2016
Nick Coghlan <ncoghlan at ...> writes:
> On 23 May 2016 at 00:35, Stefan Krah <stefan at ...> wrote:
> > Steven D'Aprano <steve <at> ...> writes:
> > [snipping excessively, since gmane.org started to lecture on this.]
> >> The custom exception handling will continue to work the same way
> >> it does now, and people who expect Decimal("spam") to raise ValueError
> >> will also be satisfied.
> >
> > They won't be if they do setcontext(ExtendedContext).
>
> At that point they've explicitly asked for unknown strings to be
> converted to "NaN", and the behaviour won't be changed by Steven's
> proposal.
Of course, but this thread was motivated by a question on the tutor
mailing list. Another question "Why isn't ValueError raised if ..."
may come up.
The answer to all that is of course to read the documentation. :)
Stefan Krah
More information about the Python-ideas
mailing list