A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/075938.html below:

[Python-Dev] Rounding Decimals

[Python-Dev] Rounding Decimals [Python-Dev] Rounding DecimalsJeffrey Yasskin jyasskin at gmail.com
Mon Jan 7 00:26:28 CET 2008
On Jan 6, 2008 1:21 AM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> On Jan 5, 2008 7:11 PM, Raymond Hettinger <python at rcn.com> wrote:
> > > I think pep 3141's round(x, ndigits) does (1). The only thing it
> > > doesn't support yet is specifying the rounding mode. Perhaps the pep
> > > should say that round() passes any extra named arguments on to the
> > > __round__() method so that users can specify a rounding mode for types
> > > that support it?
> >
> > That would clutter the interface.  Just specify a universal rounding mode for __round__ and have Decimal's implementation of that
> > method comply.
>
> Yeah, thinking about this more, a .round() method on Context objects
> seems like a better way to handle the part of Mark's request that the
> round builtin doesn't cover. Of course, there may be even better
> alternatives that I haven't thought of. I'll post a patch to
> http://bugs.python.org/issue1623 tomorrow so we have something
> concrete to talk about.

The new patch is posted: http://bugs.python.org/file9080/decimal-3141.patch
I'll implement Context.round() in a separate patch. Comment away. :)

-- 
Namasté,
Jeffrey Yasskin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4