This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: using locale does not display the intended behavior
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: doko, r.david.murray
Priority: normal Keywords:

Created on 2007-01-11 22:59 by doko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg61052 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2007-01-11 22:59
[forwarded from http://bugs.debian.org/405618]

the locales are available on the system; the string.lowercase constant doesn't change.

bug submitter writes:

Hello, if I interpret correctly http://docs.python.org/lib/node746.html
the characters 'é', 'ç' and so on should be members of 
string.lowercase when the locale is set on a french one.

But as you can see here this is not the case:

    % python
    Python 2.4.4 (#2, Oct 20 2006, 00:23:25) 
    [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import locale
    >>> locale.setlocale(locale.LC_ALL, '')
    'LC_CTYPE=fr_BE.UTF-8;LC_NUMERIC=fr_BE.UTF-8;LC_TIME=fr_BE.UTF-8;LC_COLLATE=C;LC_MONETARY=fr_BE.UTF-8;LC_MESSAGES=fr_BE.UTF-8;LC_PAPER=fr_BE.UTF-8;LC_NAME=fr_BE.UTF-8;LC_ADDRESS=fr_BE.UTF-8;LC_TELEPHONE=fr_BE.UTF-8;LC_MEASUREMENT=fr_BE.UTF-8;LC_IDENTIFICATION=fr_BE.UTF-8'
    >>> import string
    >>> string.lowercase
    'abcdefghijklmnopqrstuvwxyz'

I also tried to import string before the setlocale call or before the 
import locale call but it did not work either.
msg85360 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-04-04 01:09
rdmurray@backup:~/trunk>echo $LC_ALL
tr_TR
rdmurray@backup:~/trunk>./python
Python 2.7a0 (unknown, Apr  3 2009, 19:56:38) 
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'tr_TR'
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\xaa\xb5\xba\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz\xb5\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
>>> 

It's possible that the particular python version used in the bug report
had a bug, but if so it is no longer a problem.

Note that these attributes do not exist in the 3.x string module.
For background on this decision see eg:
http://www.mail-archive.com/python-3000@python.org/msg06518.html).
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44440
2009-04-04 01:09:59r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg85360

resolution: works for me
stage: test needed -> resolved
2009-03-30 18:48:15ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, Python 3.0, - Python 2.5
2007-01-11 22:59:32dokocreate