How about adding rational fraction to Python?

Grant Edwards grante at visi.com
Thu Feb 28 09:36:14 EST 2008


On 2008-02-28, Carl Banks <pavlovevidence at gmail.com> wrote:

>> Automatic conversions, okay... but converting a result when
>> all inputs are of one time, NO...
>
> People, this is so cognitive dissonance it's not even funny.
>
> There is absolutely nothing obvious about 1/2 returning a number that
> isn't at least approximately equal to one half.

I guess obviousness is in the eye of the beholder.  To me it's
obvious that "1" and "2" are integers, and it's also obvious
that 2 goes into 1 zero times.

> There is nothing self-evident about operations maintaining
> types.

By that logic, there's no reason for 1 + "two" shouldn't
convert one operand or the other.

> You people can't tell the difference between "obvious" and "learned
> conventions that came about because in limitations in the hardware at
> the time".

It seems to me that the expectation that 1/2 yield 0.5 is just
as much a convention as that it yield 0 or a true rational.

-- 
Grant Edwards                   grante             Yow! I am covered with
                                  at               pure vegetable oil and I am
                               visi.com            writing a best seller!



More information about the Python-list mailing list