Rational numbers

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Jan 28 14:45:03 EST 2000


"Janos Blazi" <jblazi at netsurf.de> writes:

> What do you think, wouldn't it be nice if Pythony had the built-in data type
> "rational" as LISP has? (I would like it. The truth is that the packages
> are a bit less confortable.

What's wrong with

>>> from yarn import Rat
>>> Rat(4,5) * Rat(7,12)
Rat(7, 15)

I can't imagine that you can get this much more comfortable, without
breaking existing programs. I guess you'd like 4/5 return a rational
number, even though it currently gives you 0. I would not like that.

Regards,
Martin




More information about the Python-list mailing list