Using fractions instead of floats
arnodel at googlemail.com
Mon Oct 1 18:09:21 CEST 2007
On Oct 1, 2:35 am, andresj <andres.j.... at gmail.com> wrote:
[snip Rational numbers in Python]
> I would like to get some feedback on this idea. Has this been posted
> before? If so, was it rejected? and for what?
> Also, I would like to know if you have improvements on the initial
> design, and if it would be appropiate to send it as a PEP.
As pointed out by others, implementations of rationals in Python
abound. Whereas there is a canonical representation of floats and ints
(and even longints) in the machine, it is not the case for rationals.
Moreover most programming tasks do not need rationals, so why burden
the language with them? If one needs them, there are perfectly
adequate modules to import (even though I, like many others I suspect,
have my own implementation in pure Python). Finally, arithmetic would
become very confusing if there were three distinct numeric types; it
already causes enough confusion with two!
More information about the Python-list