Message200052
| Author |
skrah |
| Recipients |
barry, ncoghlan, rhettinger, skrah, vstinner, zero.piraeus |
| Date |
2013年10月16日.10:18:46 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1381918726.42.0.914714932374.issue19266@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
trap() is a bit ambiguous, since in floating point operations it
means that something is actually raised and not suppressed. So one
could write:
from decimal import *
c = getcontext()
c.traps[Inexact] = True
>>> Decimal(9) / 11 # raises now!
with trap(Inexact):
Decimal(9) / 11 # quiet!
As for "ignore" vs. "suppress", I'm with the people who think that they
are largely synonyms here. I find "ignore" slightly catchier and nicer
to read. Being pedantic, one could call it "ignore_once".
I would also like "catch", or pedantically, "catch_once". |
|