How about adding rational fraction to Python?

Torsten Bronger bronger at physik.rwth-aachen.de
Tue Feb 26 21:41:01 CET 2008


Hallöchen!

Grant Edwards writes:

> [...]
>
> Nope.  I would prefer that int OP int always produce an int.

And 2**-1?

Your formulation tries to suggest some sort of logical consequence
but in my opinion, it's still a mere matter of taste and habits.  I
remember my first steps in C++ 12 years ago when I tried to
implement a couple of astronomical formulae, always getting false
results because C++ calculated 3/4=0.

I think the only real reason for people prefering int/int=int is
that computers can deal with inteters better than with floats,
resulting in int-only arithmetic in computer languages.  However, I
don't consider this a particularly good reason.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: bronger at jabber.org
               (See http://ime.webhop.org for further contact info.)



More information about the Python-list mailing list