A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-January/059565.html below:

[Python-Dev] locale and LC_NUMERIC

[Python-Dev] locale and LC_NUMERIC [Python-Dev] locale and LC_NUMERICGeorg Brandl g.brandl-nospam at gmx.net
Mon Jan 9 20:17:31 CET 2006
Martin v. Löwis wrote:
> Georg Brandl wrote:
>>  >>> import locale
>>  >>> locale.setlocale(locale.LC_NUMERIC, "")
>> 'de_DE at euro'
>>  >>> "%f" % 1.0
>> '1.000000'
>>  >>> u"%f" % 1.0
>> u'1,000000'
>>  >>>
>> 
>> 
>> Is this intended? This breaks test_format on my box when test_builtin (method
>> test_float_with_comma) is executed first.
> 
> No. %-formatting should always use the C locale. One should use
> locale.format to get locale-aware formatting.

While we're at it: test_builtin does

             import locale
             orig_locale = locale.setlocale(locale.LC_NUMERIC, '')
             locale.setlocale(locale.LC_NUMERIC, 'fr_FR')

and later

         finally:
             locale.setlocale(locale.LC_NUMERIC, orig_locale)


Shouldn't the first setlocale have no second argument?

regards,
Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4