Rationals?

Josiah Carlson jcarlson at uci.edu
Wed Nov 17 22:47:27 EST 2004


Mike Meyer <mwm at mired.org> wrote:
> 
> With the decimals and the unification of int and long coming, it's natural
> (for me, anyway) to wonder how much interest there is in a rational type.
> There are two PEPs (239 and 240), and the Guido rejects them as no one
> seems interested in doing the work, but points out that the python
> distribution comes with examples/Demo/classes/Rat.py.
> 
> I propose - in the spirit of "batteries included" - that Rat.py be
> cleaned up some (mostly to take advantage of the union of ints and
> longs) and moved into the standard library.
> 
> Any good reasons not to do this?

Update the PEP, do the work, and offer a good rational number object (if
you are interested in doing such). I have personally written at least
two different rational classes, and I am aware of at least 3 others
(though I can't remember their names).

If it is implemented in Python; stay away from the binary GCD algorithm,
Euclid's is faster.

 - Josiah




More information about the Python-list mailing list