[Python-Dev] locale and LC_NUMERIC (original) (raw)

Fredrik Lundh fredrik at pythonware.com
Mon Jan 9 09:54:09 CET 2006


Neal Norwitz wrote:

> I feel I'm lacking some link here: why do you think we should do that?

neal at janus ~/build/python/svn/clean-ish $ LCALL=deDE ./python >>> import locale >>> locale.setlocale(locale.LCALL) 'C' >>> locale.setlocale(locale.LCALL, 'deDE') 'deDE' I would have expected the first call to setlocale() to return deDE.

the locale is a program-specific setting (handled by the C runtime library), and is set to "C" by default.

if you want to use a specific locale, you have to call setlocale to indicate that you really want a non-default locale. the "" argument is just a con- venience; it tells the C runtime library to set the locale based on OS-level language settings (e.g. LANG on Unix, control panel settings on Windows, etc).

LANG in itself isn't the locale; it's just a way to tell a locale-aware program what the preferred locale is.



More information about the Python-Dev mailing list