Title: explain that locale.getlocale() does not read system's locales
Type: Stage: needs patch
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: alexis Nosy List: alexis, docs@python, eric.araujo, feth, terry.reedy
Priority: normal Keywords:

Created on 2011-08-11 09:18 by alexis, last changed 2011-08-12 18:58 by terry.reedy.

Messages (2)
msg141897 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2011-08-11 09:18
The documentation about locale.getlocale() doesn't talk about the fact that the locale isn't read from the system locale. Thus, it seemed strange to have locale.getlocale() returning (None, None).

As it seems to be the expected behaviour, it seems useful to specify this in the documentation and make it explicit.

I'm okay to write a patch and apply it.

This issue is related to #6203, but does not supersede it (the two conversations are discussing two different things).
msg141986 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-08-12 18:58
Our docs explain behavior without, generally, explaining why. Hence the title change.

'Returns the current setting for the given locale category' seems pretty clear that it returns the current program setting rather than the default system setting. However, 'program' could be added to be clearer.

The previous discussion for locale.getdefaultlocale makes it clear that the starting program locale is (should be) the "portable 'C' locale". I presume you are saying that in this locale, the setting for the default LC_CTYPE category is (None,None). However, this appears to currently only be true for 2.7. So I suppose we could add for 2.7 "In the starting 'C' locale, the LC_CTYPE setting is (None,None)." (Given the next paragraph describing 'C' as a non-standard language code, I would have expected ('C',None), but it is as it is.)

Reading #6203, something different is needed for 3.2 and something else again might be needed for 3.3 depending on what is or is not done.
Date User Action Args
2011-08-12 18:58:24terry.reedysetnosy: + terry.reedy

messages: + msg141986
title: explain why locale.getlocale() does not read system's locales -> explain that locale.getlocale() does not read system's locales
2011-08-12 17:56:16eric.araujosetnosy: + eric.araujo, docs@python
stage: needs patch

versions: + Python 2.7, Python 3.2, Python 3.3
2011-08-11 09:18:55alexiscreate