"Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
> There may still be a use for a rational module in the standard library,
> but builtin support is no longer needed or desirable.

Sounds good.

> The rational proposal also has an intrinsic weakness shared with Java's
> prior versions of BigDecimal which they found to be unworkable in
> practice.  The weakness was that repeated operations caused the internal
> number of digits to grow beyond reason.  For this reason, the PEP
> proposes some arbitrary level of truncation which conflicts with the
> goals of having "obvious and exact" arithmetic.  The proposed truncation
> methodology was undeveloped and made no proposal for the same fine level
> of control as its counterpart in the decimal module where issues of
> variable precision, multiple contexts, and alternate rounding modes have
> been fully thought out.

Here is an option: exploit all of the thought and effort that has gone
into decimals.  Offer a "context" argument which handles the precision
and rounding of the rational numerator and denominator as necessary,
defaulting to the current decimal context, with automatic rounding
(using the same kinds of semantics that decimals currently uses). Offer
a mechanism by which one can use exact rationals, which use longs rather
than decimals.

The idea obviously needs fleshing out, but perhaps it is a start for
someone who wants rationals in the standard library.

 - Josiah

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to