[Python-Dev] Floor division

Anthony Baxter anthony at interlink.com.au
Tue Jan 23 14:20:35 CET 2007


On Tuesday 23 January 2007 22:27, Tim Peters wrote:
> Which is why I don't want binary or decimal floats to support
> infix "%" as a spelling in P3K.  I don't believe floating mod is
> heavily used, and if so there's scant need for a one-character
> spelling -- and if there's a method or function name to look up
> in the docs, a user can read about what they're getting.

While I agree with this, my only slight concern is that under 2.x
(int/int)%(int) will work, while it will fail under 3.x, because 
int/int will return a float. Eh - we can always make 2.6 warn about 
the floatobject's __mod__ function being called if the -W py3k 
option is on, that gets us part of the way there. And if we have 
a "-3" option or the like that also turns on maximum 3.x compat, 
that will enable true division, producing the warning.

Like I said, it's only a slight concern...


-- 
Anthony Baxter     <anthony at interlink.com.au>
It's never too late to have a happy childhood.


More information about the Python-Dev mailing list