[Python-Dev] Re: Decimal data type issues

Tim Peters tim.one at comcast.net
Thu Apr 22 19:32:39 EDT 2004


[Michael Chermside]
> Me too. But let's promise that the docs will include an example
> of how to use quantize() to do rounding, since the name will
> not be obvious to the uninitiated.

I agree it won't.  In some ways it's nicer than round(), because it works by
providing an example of the scale you want, not by making you count
positions from the decimal point.

BTW, note that the spec has nothing to say about how an implementation
spells anything, except for the results of the to-string operations.  That
is, there's no requirement to *call* the spec's quantize operation
"quantize"; the requirement is to provide something with the semantics of
the spec's quantize operation.  For example, round_like() or rescale() might
be friendlier names (in fact, the current quantize used to be called rescale
in the spec).





More information about the Python-Dev mailing list