Multiplying sequences with floats
Caleb Hattingh
caleb.hattingh at gmail.com
Fri Mar 24 17:33:03 EST 2006
Hi Christoph
On my linux py-2.4.1:
>>> 4.0//2 # Integer division, but still returns a float.
2.0
>>> 4.0//2 == 2
True
>>>
4.0//2 doesn't return an integer, but the equality against an integer
still holds. I agree that integer division should return an integer,
because using the operator at all means you expect one. Having to
cast it after integer division seems unnecessary. Unfortunately, I
have zero say on the matter :)
This issue was probably discussed at length when the integer division
operator (//) was introduced. It is possible there is a good reason
behind this, but I don't know it.
regards
Caleb
More information about the Python-list
mailing list