Why not FP for Money?

Batista, Facundo FBatista at uniFON.com.ar
Fri Sep 24 16:20:56 EDT 2004


[Carlos Ribeiro]

#- If I got Paul right, it means the same I've been advocating: a
#- notation to write floating point decimals directly without 
#- the need to
#- pass strings or floats. We've proposed some alternatives:
#- 
#- 1) 'd' suffix:  a = 10.123d
#- 2) '$ prefix:  a = $10.123

Right now Decimal is a python-pure module. Someday, it'll become a C module
for speed reasons (don't expect that from me, don't know enough C). Someday,
after that, *maybe* it'll become a core data type, and there we'll have to
discuss all that (and it won't be a ten-messages-thread, I can assure you).

Why those steps? To achieve a community consensus for the PEP I've made was
not easy and took me a long time. Before it becomes a core data type (if
someday), decimal needs to be used *widely*. So start spreading the word! :)


#- For now, I'm just playing with the alternatives -- it's pretty much
#- like the big decorator debate, only the timing is better :-)  (just
#- joking, really -- a good literal notation is *much* needed to allow
#- use of decimals without binary floating point surprises 
#- happening from
#- time to time).

Meanwhile, use decimal.Decimal("<number>").

.	Facundo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040924/93fd23e0/attachment.html>


More information about the Python-list mailing list