# [Python-ideas] Deprecate the round builtin

Mike Graham mikegraham at gmail.com
Thu Sep 27 06:10:34 CEST 2012

```On Wed, Sep 26, 2012 at 10:15 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> I don't believe that round gets misused and causes confusion to any
> significant
> degree. That belief is based on many years experience on two high-traffic
> mailing
> lists with many beginners. I've seen plenty of examples of beginners
> confused that
> Python can't add floats correctly, but if I've ever seen somebody confused
> by round,
> it was so uncommon and so long ago I've forgotten it.
>
> It seems to me that this proposal is based on a purely theoretical fear that
> some
> people manage to escape being confused by the far more obvious floating
> point
> gotchas[1] but can't understand round. There are much more common, and
> bigger,
> surprises with binary floats than round, and it seems to me that
> depreciating it
> just disrupts those who do use it for no real benefit.

I don't have a "purely theoretical fear" regarding round; I simply
have had a different experience and analysis than you. I have long
been an active member of the official Python IRC channel and other
Python IRC channels and of various other support communities (I beat
StackOverflow before they added the new levels :) ). I have seen many,
many people have questions about round and they almost always don't
want to be using it. Most often, people really want to be using string
formatting, but there are all sorts of . I posted here today after yet
another person came into #python with a round question where they
didn't want round.

My problem with round isn't that new people don't understand it--it's
that there's nothing worth understanding. (With floats, the situation
merely requires education then people can use floats well. With round,
when you learn you stop using it.) round(x, n) for n>0 is quite simply
not sane code. rounding is an exact operation and it does not make any
sense to do base 10 rounding on base 2 numbers in this way. round for
n <= 0 is not so criminal, but it sometimes-inconveniently returns a
float and it's trivially written shorter/as-easily for n=0 and seldom
actually needed for n<0.

Mike

```

More information about the Python-ideas mailing list