[Python-Dev] trunc()

Andrea Griffini agriff at tin.it
Sun Jan 27 18:26:01 CET 2008


On Jan 27, 2008 5:43 PM, Guido van Rossum <guido at python.org> wrote:

> - Deprecating int(<float>) is pretty radical, I think it would have to
> happen in the distant future. OR not at all. I'm at best +0 on this,
> more like exactly 0. I realize that in practice this kills the idea.
> The "purist" argument for it would have worked better if it was made
> 18 years ago.

Also what happens with "%i" % 3.14 ? We incidentally found a problem
with a script using python 2.5 because apparently the "%" formatting
operator doesn't use "int()" for doing the conversion (to be more specific
if the float is too large for a 32-bit integer then the format operator chokes
while the int() operator returns a long).
Anyway I want just to say that if "implicit" conversion from float
to integer goes away then what happens to formatting conversion ?
Removing that too IMO would break a lot of code and it's IMO very
difficult to help fixing that.

Andrea


More information about the Python-Dev mailing list