[Python-Dev] Integer division operator can give float result?

Fred L. Drake, Jr. fdrake at acm.org
Wed Feb 28 05:30:40 CET 2007


On Tuesday 27 February 2007 22:34, Greg Ewing wrote:
 > Is this intentional? I would have expected the
 > // operator to always give an integer result.

Think "floor division", not "integer division".  The result (r) may be a 
float, but it'll hold to the constraint:

    r == int(r)


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>


More information about the Python-Dev mailing list