Rational Numbers

Carsten Haese carsten at uniqsys.com
Fri Jan 12 09:14:59 EST 2007


On Thu, 2007-01-11 at 23:47 +0000, Nick Maclaren wrote:
> In article <mailman.2597.1168550439.32031.python-list at python.org>,
> Facundo Batista <facundo at taniquetil.com.ar> writes:
> |> Noud Aldenhoven wrote:
> |> 
> |> > When I was programming in a mathematical project I began to wonder if python
> |> > supports rational numbers[1]. In a language like magma[2] it's not such a
> |> > problem. Does python supports something simular?
> |> 
> |> Python does not have rational numbers.
> |> 
> |> There's a (rejected) PEP about this, PEP-239:
> |> 
> |>   http://www.python.org/dev/peps/pep-0239/
> |> 
> |> Maybe you also want to read the section "Why not rational?" of
> |> PEP-327...
> |> 
> |>   http://www.python.org/dev/peps/pep-0327/#why-not-rational
> 
> Oh, God.  Decimal delusions again :-(
> 
> There are good arguments for not having a rational type, but the idea
> that decimal floating-point is in any way a replacement is cuckoo.

You're putting words in Facundo's mouth. Facundo didn't say why we
should read that section of PEP 327. I think he merely pointed to the
slow performance of rational numbers that's explained in that section.
(Facundo is the author of PEP 327, so I find it unlikely that he has
delusions about what decimals can and can't do.)

It is true that decimal arithmetic is not a replacement for rational
arithmetic, but I don't see anybody on this thread or in PEP 327 stating
that it is.

-Carsten





More information about the Python-list mailing list