About Rational Number (PEP 239/PEP 240)

Arnaud Delobelle arnodel at googlemail.com
Sat Dec 15 18:44:26 EST 2007


On Dec 15, 10:38 pm, Lie <Lie.1... at gmail.com> wrote:
[...]
>
> Yeah, that's why I consider them too complex for being included as a
> core of a general programming language like Python. Nevertheless,
> fraction datatype _IS_ elementary enough to be included as core
> language feature.

Rationals are not that simple.

* Unless you are working under very controlled conditions, rationals
very quickly grow enormous numerators and denominators, hence
require arbitrary precision integers (which, I concede, are part of
Python).

* In order to have a canonical representation of integers, they need
to be kept in normalised form.

* Nobody uses big fractions apart from mathematicians (and maybe
bookmakers?).

* Having yet another numerical type would make it difficult what
type to expect from a calculation.

--
Arnaud




More information about the Python-list mailing list