[Python-3000] [Python-Dev] Rounding Decimals
aahz at pythoncraft.com
Mon Jan 7 16:53:26 CET 2008
On Mon, Jan 07, 2008, Raymond Hettinger wrote:
> [Jeffrey Yasskin]
>> I am not building out the decimal API. I am adding enough methods to
>> maintain the comment that "Decimal floating point objects share many
>> properties with the other builtin numeric types such as float and int.
>> All of the usual math operations and special methods apply." in both
>> 2.6 and 3.0. After that's done, I am interested in talking about
>> adding one method that 3 people on this list have been interested in.
>> I understand that you need to be vigilant against extraneous methods,
>> but I'm really not just adding these on a whim.
> Arghh! You seem hell-bent on jamming this in. Please leave the
> decimal module alone. It does *not* need both a round() method
> and a quantize() method.
> I read Glyph's note and agree that it wasn't obvious how to round
> with the existing API. That is a documentation problem, not a call
> to add duplicate methods.
Excuse me. I have always thought that "quantize()" makes Decimal
confusing in the context of the other mechanisms that Python makes
available for other kinds of numbers. I have refrained from making an
issue of it because I understand and (mostly) support the idea of
keeping Decimal restricted to matching the decimal standard, but at this
point, it seems that Tim Peters likes the idea, too. While I have a lot
of respect for you, I think Uncle Timmy deserves some special respect,
> When one of the module authors asks you to refrain for expanding
> the API, please pay special attention. In this case, you are working
> directly against a core philosophy for the design and maintenance
> of the module.
I'm not a current maintainer, but I was one of the instigators for the
existence of Decimal. I understand that you're feeling frustrated about
changes getting shoved in, but I don't think that discussion should be
shut down because you have a particular point of view: the decimal
module does not represent only your work.
I suggest that the patches get dropped for the moment and the discussion
rebooted. I haven't been following closely, but it seems that the main
issue is that Python 3.0 is introducing a __round__() method. How do you
think the decimal module should handle that? (Although I still like the
idea of a .round() method for decimals, I think that round(Decimal()) is
probably sufficient enough that I won't insist on it.)
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Weinberg's Second Law: If builders built buildings the way programmers wrote
programs, then the first woodpecker that came along would destroy civilization.
More information about the Python-3000