[Python-ideas] Rough draft: Proposed format specifier for a thousands separator (discussion moved from python-dev)

Jim Jewett jimjjewett at gmail.com
Fri Mar 13 04:50:17 CET 2009


On 3/12/09, Eric Smith <eric at trueblade.com> wrote:
> Eric Smith wrote:
>> ... formats
>> a number based on the same settings that are in the locale, but not
>> actually use the locale.
...

> The key point is that it takes everything as parameters and doesn't use
> any global state. In particular, it by itself would not reference the
> locale.

Why not?  You'll need *some* default for decimal_point, and the one
from localeconv makes at least as much sense as a hard-coded default.

I agree that it shouldn't *change* anything in the locale, and any
keywords explicitly passed in should override locale, but if it never
looks at locale, you'll get patterns like

import locale
kw=dict(locale.localeconv)
kw['thousands_sep']=' '

new_util_func(number, **kw)

-jJ



More information about the Python-ideas mailing list