How to parsing a sequence of integers
joe at strout.net
Fri Dec 19 18:01:42 CET 2008
>> from __future__ import division
>> at the top of the file. I put this at the top of all my Python files,
>> whether I expect to be dividing or not. It just saves grief.
> If you want division to be floating point.
> If, like me, you rarely do floating point
> division and want the "/" to mean integer
> division as God intended, then you don't
> put from __future__ import division in your
> source files.
> That's one of the good things about Python,
> you can have it either way.
Until you someday move up to Python 3, at which point you'll have to go
back and change all your code to use the unambiguous // operator when
you mean integer division. Better to do it now, I think, at least in
any new code you write, to save you the hassle later.
For those not familiar with the topic:
More information about the Python-list