[Python-Dev] Rounding Decimals (original) (raw)
Jeffrey Yasskin jyasskin at gmail.com
Sun Jan 6 10:21:11 CET 2008
- Previous message: [Python-Dev] Rounding Decimals
- Next message: [Python-Dev] Rounding Decimals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
-- Namasté, Jeffrey Yasskin
- Previous message: [Python-Dev] Rounding Decimals
- Next message: [Python-Dev] Rounding Decimals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]