Arbitrary precision integer arithmetic: ceiling?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Mar 9 08:09:11 EDT 2008


On Sun, 09 Mar 2008 20:57:15 +1100, Alasdair wrote:

> Thanks, all - you've been most helpful.  By the way, what does // do?  I
> haven't yet run down its definition in the manual.

// is integer division.

>>> 10//5
2
>>> 11//5
2



In Python 2.5 and older, / means integer division, unless you do

from __future__ import division

in which case / is true division, that is:

>>> 10/5
2
>>> 11/5
2.5


In Python 3.x, / will always be true division, and you won't need the 
import.


-- 
Steven



More information about the Python-list mailing list