[Python-Dev] trunc()

Jeffrey Yasskin jyasskin at gmail.com
Sun Jan 27 18:43:39 CET 2008


On Jan 27, 2008 9:26 AM, Andrea Griffini <agriff at tin.it> wrote:
> 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.

Well, it seems like it would be as easy to make some formatting
conversions raise a warning on float inputs as it would be to make
int() do it. But I think you're safe here; it doesn't look like either
will be deprecated.

-- 
Namasté,
Jeffrey Yasskin
http://jeffrey.yasskin.info/


More information about the Python-Dev mailing list