[Python-Dev] shouldn't we be considering all pending numeric proposals together?

Guido van Rossum guido@digicool.com
Wed, 25 Jul 2001 13:26:28 -0400

> Guido van Rossum wrote:
> > ...
> > I actually expect that most conversion jobs will be easy -- all those
> > folks who suffer from "Extreme Fear of Floating Point" (as Tim calls
> > it) can simply change every / into a // in their program (using a tool
> > that properly tokenizes) and they should be done, since most likely
> > their code never uses floating point. :-)
> Well, that would break floating points then...

Not under the assumption that they will never use floating point.

> unless float // float works like float / float does now.

No, that would be a bad idea.  float//float should either raise an
exception or return a rounded-towards-minus-infinity result.

> Perhaps you should simply 
> add a nb_altdivide slot to the numeric set of slots which is then
> called for a // b. Floats would then reuse their nb_divide 
> for //.

Something like this is part of the implemenation plan (not yet part of
the patch).

> BTW, my idea about rationals turns out not to work too well:
> 1/6 + 5/6 would give 6/6 == 1 while the current semantics 
> return 0 in this case.

Indeed, rationals can't ease the pain of PEP 238 -- but PEP 238 is
required before rationals can make sense.

--Guido van Rossum (home page: http://www.python.org/~guido/)