[Python-Dev] locale and LC_NUMERIC
"Martin v. Löwis"
martin at v.loewis.de
Mon Jan 9 22:56:12 CET 2006
Neal Norwitz wrote:
> neal at janus ~/build/python/svn/clean-ish $ LC_ALL=de_DE ./python
>
>>>>import locale
>>>>locale.setlocale(locale.LC_ALL)
>
> 'C'
>
>>>>locale.setlocale(locale.LC_ALL, 'de_DE')
>
> 'de_DE'
>
> I would have expected the first call to setlocale() to return de_DE.
No, it shouldn't. We are providing C semantics here, which is that
no locale functionality is activated unless the application explicitly
asks for it.
> Is the first call to
> setlocale() supposed to return C? If so, always?
The return value is implementation-defined, but yes, it is supposed
to return the "C" locale (which is synonymous to the "POSIX" locale
on a POSIX system).
> I was looking for
> some way for the initial call to setlocale() to return de_DE or
> whatever other locale I set.
That shouldn't happen.
Regards,
Martin
More information about the Python-Dev
mailing list