Integer and float division [was Re: Why Python 3?]

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Apr 20 19:44:07 EDT 2014


> On Sat, 19 Apr 2014 19:37:31 +1000, Chris Angelico wrote:
 >
>>In Python 3, you have to say "Oh but I want my integer division to
>>result in an integer":

I don't see why that's such a big hardship.

There are clear advantages to having an explicit way to
request non-floor division. Whatever way is chosen for
that, some other way has to be chosen to request floor
division.

One could debate whether it would have been better to make
/ mean floor division and invent something else for
non-floor division, but then some people would complain
"Oh, but I have to say I want my float division to return
a float!"

Either way requires people to make some changes in their
habits.

-- 
Greg



More information about the Python-list mailing list