How about adding rational fraction to Python?

Carl Banks pavlovevidence at gmail.com
Thu Feb 28 10:37:17 EST 2008


On Feb 28, 9:36 am, Grant Edwards <gra... at visi.com> wrote:
> On 2008-02-28, Carl Banks <pavlovevide... 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.

2 goes into 1 0.5 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.

False dilemma, chief.  That preserving type is not self-evident
doesn't make all operations that don't preserve type a good idea.


> > 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.

Sure it is, but unlike the old convention, it's the obvious one.


Carl Banks



More information about the Python-list mailing list