On Mon, Oct 1, 2018 at 9:36 AM Steven D'Aprano <st...@pearwood.info> wrote:
> Then we can add a keyword only argument to round:
>
>     round(number, ndigits=0, *, mode=ROUND_HALF_EVEN)
>
> To use it, you can import the rounding mode you want from math:
>
>     from math import ROUND_CEILING
>     round(x, 3, mode=ROUND_CEILING)

I have no problem with this.

> and everyone is happy (he says optimistically).

And I am as dubious as you are about this :)

IMO, the biggest problem with round() is that it's TOO discoverable.
People reach for it when what they really should be using is string
formatting ("I want to display all these values to three decimal
places"), and then sometimes get bitten when something doesn't
actually display the way they think it will. When it's used correctly,
it's usually fine.

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to