Why not FP for Money?
duncan.booth at invalid.invalid
Thu Sep 23 13:56:40 CEST 2004
Carlos Ribeiro wrote:
> Now that we are talking about money types, I had an idea some time
> ago and I would appreciate to hear some opinions. What do you think
> about using a different notation for fixed point decimal literals in
> Python, using the $ sign, as in:
> a) $1.0000 --> fixed point decimal, four digits of precision
> b) 1$0000 -> alternative syntax, also with four digits
> and operations would also be easier to write, with type coercion, etc:
> $1.00 + 0.99212 --> $1.99 (rounded)
> That would make easy to supply fixed point literals. And I dont think
> that the use of a symbol, in this case, is a case of Perlish
> contamination -- even in countries where the money sign is different,
> I think that most programmers would readily recognize the $ sign for
> it. How about it?
I don't see the benefit.
Can you give a use-case where you would actually write $1.00 + 0.99212
rather than, say, 'balance + interest'?
For that matter can you give a use case where you actually need to write
fixed point decimal literals in your code rather than taking them out of a
More information about the Python-list