[Python-Dev] Rounding float to int directly ...
Christian Tanzer
tanzer at swing.co.at
Thu Aug 3 10:44:51 CEST 2006
Nick Maclaren <nmm1 at cus.cam.ac.uk> wrote:
> tanzer at swing.co.at (Christian Tanzer) wrote:
> > Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> >
> > > What's the feeling about this? If, e.g. int()
> > > were changed in Py3k to round instead of truncate,
> > > would it cause anyone substantial pain?
> >
> > Gratuitous breakage!
> >
> > I shudder at the thought of checking hundreds of int-calls to see if
> > they'd still be correct under such a change.
>
> My experience of doing that when compilers sometimes did one and
> sometimes the other is that such breakages are rarer than the
> conversions to integer that are broken with both rules! And both are
> rarer than the code that works with either rule.
>
> However, a 5% breakage rate is still enough to be of concern.
I couldn't care less about how many calls would break -- I'd still
need to look at each and every one. And I know that quite a number of
calls need the truncation semantics (I just don't know which without
looking).
--
Christian Tanzer http://www.c-tanzer.at/
More information about the Python-Dev
mailing list