instead of raising a TypeError. Allows other types to successfully
implement __radd__() style methods.
* Remove future division import from test suite.
* Remove test suite's shadowing of __builtin__.dir().
(Contributed by Facundo Batista.)
Code simplification by eliminating the unnecessary and error-prone
convolutions for the previously weird sign convention in _WorkRep().
Makes the code more understandable, more reliable, and a bit faster.
(Contributed by Nick Coghlan.)
Various code cleanups and optimizations (saves about 40% on testsuite
execution time and on the telco benchmark).
* caches results of various operations on self (esp. checks for being
a special value).
* _WorkRep now uses ints and longs for intermediate computations.
(version 1.45):
The max and min operations follow the rules in the current IEEE 754 revision draft:
if one operand is a quiet NaN and the other is number, then the number is always returned
if both operands are finite and equal in numerical value then an ordering is applied:
if the signs differ then max returns the operand with the positive sign and
min returns the operand with the negative sign; if the signs are the same then
the exponent is used to select the result.
by the locals() call in the context constructor.
* Remove unnecessary properties for int, exp, and sign which duplicated
information returned by as_tuple().
* Rename "trap_enablers" to just "traps".
* Simplify names of "settraps" and "setflags" to just "traps" and "flags".
* Show "capitals" in the context representation
* Simplify the Context constructor to match its repr form so that only
the set flags and traps need to be listed.
* Representation can now be run through eval().
Improve the error message when the Decimal constructor is given a float.
The test suite no longer needs a duplicate reset_flags method.
public.
* Removed the non-signal conditions from __all__.
* Removed the XXX comment which was resolved.
* Use ^ instead of operator.xor
* Remove the threading lock which is no longer necessary.
* Map conditions to related signals.
* Make contexts unhashable.
* Eliminate used "default" attribute in exception definitions.
* Eliminate the _filterfunc in favor of a straight list.
Docs:
* Eliminate documented references to conditions that are not signals.
* Eliminate parenthetical notes such as "1/0 --> Inf" which are no
longer true with the new defaults.
This serves to made the context representation more useful (the names in
match the names out).
Removed the link to ReXX. That document did not shed add anything to
information already in the spec.
Further tighten the public API to improve usability:
* Emax and Emin are set through Context(). Their defaults are set in the
DefaultContext, so there is no need to expose DEFAULT_MAX_EXPONENT
and DEFAULT_MIN_EXPONENT.
* The string functions isnan() and isinfinity() were only used internal to
the module and were not among the test cases. External use cases are
served by the Decimal constructor. So, made these private.
* delete temporary globals immediately after use
* move a global into a class variable
* Rename BasicDefaultContext and ExtendedDefaultContext
to BasicContext and ExtendedContext.
* Added test for pickling contexts
* Renamed ExceptionList to Signals (to match wording in the spec)
* Simplified Context constructor by allowing flags=None to automatically
generate a zeroed-out flags dictionary.
* inlined _convertString() which was used only once
* _rounding_decision is private, so excluded its contants from __all__.
* added an XXX comment with concerns about subclassing signals results in
a deviation from the spec (maybe important, maybe not).
* Taught the test_suite to determine its own directory (modeled after code
in regrtest.py). Enables it to be run when the current directory is not
the test directory.
* Added a clear_flags() method to the Context API to make it easier to do
a common operation with flags.
* Fixed the trap_enablers defaults in BasicDefaultContext to match the spec.