[Python-3000] [Python-Dev] Rounding Decimals

Raymond Hettinger python at rcn.com
Sun Jan 6 04:11:49 CET 2008


> 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.

If someone wants more control than that, they can manipulate the decimal object directly.


Raymond 


More information about the Python-3000 mailing list