About Rational Number (PEP 239/PEP 240)

Lie Lie.1296 at gmail.com
Sat Dec 15 17:38:17 EST 2007


On Dec 16, 4:55 am, "Fredrik Johansson" <fredrik.johans... at gmail.com>
wrote:
> On Dec 15, 2007 10:05 PM, Lie <Lie.1... at gmail.com> wrote:
>
> > Random ramble past here:
> > Actually, my vision would be not only fractions, but also rooted
> > number (square root, cube root, etc), it could be possible to
> > implement a type where a number consist of a rooted number times a
> > multiplier plus a variable [a + b * root(c, d)]. But I guess this
> > would be extremely complex and it requires nesting, probably very slow
> > if implementation isn't good. The advantage of using such is much
> > faster operations, as long as str() is not called. This actually
> > reflects my way of doing paper math, I save the lossy operations
> > (float division, root, trigonometric function) until the very end of
> > calculation (I'm not fundamentalist though, so compromise sometimes is
> > done here and there).
>
> You're looking for a computer algebra system. Try sympy:http://code.google.com/p/sympy/
>
> Fredrik

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.



More information about the Python-list mailing list