prePEP: Decimal data type
newsgroups at jhrothjr.com
Sat Nov 1 18:32:57 CET 2003
"Alex Martelli" <aleax at aleax.it> wrote in message
news:a%Rob.394217$R32.13072021 at news2.tin.it...
> John Roth wrote:
I decided to snip the prior piece rather than argue about your
misconception of what I intended. This would have been obvious
if you had left the context of my comment in, rather than starting
it out with my response to something invisible to the reader.
> > I think someone earlier suggested (in the context of the Money type)
> > having the number of digits be an optional arguement to the constructor.
> > That is: decimal(1.1, 1) showing one place after the decimal point.
> Constructing with some specified precision (not "SHOWING" but actually
> constructing) would be fine. "Places after the decimal point" may or
> may not be the ideal way to specify precision, that's a different issue
> (if there are any applicable standards, I'd go for those, rather than
> make any arbitrary decision in the matter). But letting the precision
> default if left unspecified -- and thus letting construction from floats
> just happen -- is a far different decision. Naive users will always
> _believe_ that they're getting "good" precision, if they think at all
> about the matter (which unfortunately they may not), unless they _are_
> forced to think about the subject by needing to specify precision very
> explicitly. Thus, I think "construction from float with some default
> precision" runs a substantial risk of tricking naive users.
I agree with that. I'd just as soon require that the precision
be specified if the input is a float.
As far as using number of places after the decimal point, rather
than some other unit, I will admit that I can't think of another unit.
More information about the Python-list