How to parsing a sequence of integers

Mensanator mensanator at aol.com
Fri Dec 19 10:57:53 EST 2008


On Dec 19, 9:23�am, Joe Strout <j... at strout.net> wrote:
> Peter Otten wrote:
> > If you are using Python 2.x:
> > ...
> > So you better throw in a float(...):
>
> Or, add
>
> � �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.


>
> Cheers,
> - Joe




More information about the Python-list mailing list