[Tutor] Evaluate my script?
Luke Paireepinart
rabidpoobear at gmail.com
Tue Oct 24 17:16:01 CEST 2006
> I would recommend using "from __future__ import division" at the top of your
> script, so division behaves properly (3/2 == 1.5 instead of 1). This way you
> don't have to make sure you write 3.0/2 everywhere you need to divide something.
> There's something to be said for your approach as well though, since someone
> reading your code would know what to expect when seeing 3.0/2, without caring
> whether "from __future__ import division" is used. But I consider the integer
> division in Python improper behavior that is fixed by this statement.
so in Python 3000 there's no more integer division?
I hope this is not the case.
Sometimes it's the desired action, like when you repeatedly divide/mod a
variable.
More information about the Tutor
mailing list