Walter Bright:
> If Python always used floor division, why did it add a // operator that 
> does exactly the same thing as / ?

See this (Python 2.6):

>>> 500 / 30
16
>>> 500 // 30
16
>>> 500 / 30.0
16.666666666666668
>>> 500 // 30.0
16.0
>>> from __future__ import division
>>> 500 / 30
16.666666666666668
>>> 500 // 30
16
>>> 500 / 30.0
16.666666666666668
>>> 500 // 30.0
16.0

// Always return a number with no fractional part.

That "future" is the default in Python 3+

Bye,
bearophile

Reply via email to