how to convert an integer to a float?

Subscriber123 subscriber123 at gmail.com
Tue Feb 27 21:08:49 EST 2007


How did the new division ever get approved?! That's not pythonic! What if
you then need to divide two integers and find an element in a list or dict?
It will give you an error! I know that at the moment it is not implemented
unless imported from __future__, but I expect that it eventually might be.
That would be a problem with backwards compatibility.

On 2/27/07, Bjoern Schliessmann <
usenet-mail-0306.20.chr0n0ss at spamgourmet.com> wrote:
>
> yinglcs at gmail.com wrote:
>
> > def compareValue(n1, n2):
> >     i1 = int(n1)
> >     i2 = int(n2)
> >
> >     dx = abs(i2 - i1)/min(i2, i1)
> >     print dx
> >     return dx < 0.05
>
> You could also prepend
>
> from __future__ import division
>
> Regards,
>
>
> Björn
>
> --
> BOFH excuse #237:
>
> Plate voltage too low on demodulator tube
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070227/5dfcd802/attachment.html>


More information about the Python-list mailing list