// is unconditionally "truncating division", e.g:
As you see, even though both operands are
// still truncates -- so you always know securely what it's gonna do.
/ may or may not truncate depending on Python release, future imports, and even flags on which Python's run, e.g....:
$ python2.6 -Qold -c 'print 2/3'
$ python2.6 -Qnew -c 'print 2/3'
As you see, single
/ may truncate, or it may return a float, based on completely non-local issues, up to and including the value of the
So, if and when you know you want truncation, always use
//, which guarantees it. If and when you know you don't want truncation, slap a
float() around other operand and use
/. Any other combination, and you're at the mercy of version, imports, and flags!-)