[Python-ideas] locale-independent number formatting (was: Rough draft: Proposed format specifier for a thousands separator)

Eric Smith eric at trueblade.com
Fri Mar 13 01:02:20 CET 2009

Bruce Frederiksen wrote:
> Eric Smith wrote:
>> >>> format_number(whole_part='123456787654321',
>>               decimal_point=',',
>>               thousands_sep='.',
>>               grouping=[4, 3, 2])
>> >>> ''
> Maybe the 'thousands_sep' parameter should be called 'grouping_sep' 
> (since it doesn't always group by thousands)?
> -bruce frederiksen

thousands_sep is the locale.localeconv() name, which I suggest we use.

I suggest that this particular API only support the LC_NUMERIC fields 
(decimal_point, grouping, thousands_sep), and that maybe we have a 
separate format_money which supports the LC_MONETARY fields.


More information about the Python-ideas mailing list