prePEP: Decimal data type

John Roth newsgroups at jhrothjr.com
Sat Nov 1 12:33:51 EST 2003


"Irmen de Jong" <irmen at -NOSPAM-REMOVETHIS-xs4all.nl> wrote in message
news:3fa3e7fb$0$58697$e4fe514c at news.xs4all.nl...
> John Roth wrote:
>
> > In the spirit of explicit is better than implicit, I'd rather have
> > the control inherent in a div() operator.
>
> +1 (without having read all of the thread, but John's
> statement sounds very reasonable to me)
>
> > 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.
> >
> > However, I prefer having the compiler take care of it.
>
> I think I don't. Consider:
>
> d=decimal(1.1)
>
> versus:
>
> f = 1.1
> d = decimal(f)
>
> this would yield different results then. And I think that's confusing.
>
> Although decimal(1.1,1) -with the extra argument "1 decimal place"-
> isn't really pretty either, IMHO: you have to actually count the
> number of decimal digits yourself!

See Alex's comment, and my response. I agree it isn't pretty,
but the alternatives seem to be worse.

John Roth
>
> --Irmen de Jong
>






More information about the Python-list mailing list