LC_MONETARY formatting

Colin Fox cfox at
Sat Jan 10 01:01:12 CET 2004

On Sat, 10 Jan 2004 00:27:26 +0100, Martin v. Loewis wrote:

> Colin Fox wrote:
>> I would like to be able to print "$12,345.60"
>> Is there a format string, or function, or *something* that will take
>> advantage of the monetary formatting info in the locale object? 
> No.

I can't believe that I'm the first person who ever wanted to print a
number as a currency value. Why go to the great lengths of what's provided
in localeconv(), only to leave it up to every single programmer to
re-implement the solution? What a waste of time and effort!

I can't see any reason not to provide a monetary converter within locale,
particularly when it's obviously got all the info it needs. 
> IOW, LC_MONETARY is useless for financial applications - if the amount
> is in €, using the locale's currency symbol would be wrong.

That's true whether you use LC_MONETARY or not. Unless you know the units
your number is in, you can't assign a symbol to it. In my case, I have
numbers that are always in either Canadian or US dollars, so the dollar
sign is fine, and the thousands-separator value is fine.


More information about the Python-list mailing list