Why not FP for Money?

Carlos Ribeiro carribeiro at gmail.com
Sat Sep 25 06:25:59 CEST 2004

On Fri, 24 Sep 2004 18:52:38 -0700, Robert Brewer <fumanchu at amor.org> wrote:
> That would certainly keep Decimal objects from becoming the default
> number type in Python 3.0. But if a suffixed "d" is retained, it becomes
> Yet Another Thing To Learn, not unlike the current surprises with
> floating-point.

As a compromise, having the 'd' suffix is better than having no option
to write true decimal point literals.
> The "end-user" would have to be more explicit in order to achieve the
> desired behavior:
>     x = 1.10d   # Notice the trailing 0
>     for _ in range(5):
>         x += 0.02d
>     print x              ----> 1.20d
> In the case of using Decimals as a Money type, this wouldn't be much of
> a burden on any society with a decimalized currency (IMO); it's standard
> practice to write the trailing zero.

I agree with you -- that's what I had in mind when I wrote my example.
But for some strange reason I also agree with Jeff's example :-) It
only shows how much work is needed before we have something that
really works in a sane and reasonable way.

Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com

More information about the Python-list mailing list