prePEP: Decimal data type

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sat Nov 1 12:06:03 EST 2003


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!

--Irmen de Jong





More information about the Python-list mailing list