Well, yes.
I find can indeed use;    locale.setlocale(locale.LC_ALL) thanks!
In addition to locale.setlocale(locale.LC_ALL, None)
I found I can also use; locale.setlocale(locale.LC_ALL, 'en_GB')
The question remains, why does; locale.setlocale(locale.LC_ALL, '') fail, 
especially if it is good practice?

 
-A


 

-----Original Message-----
From: spir <denis.s...@gmail.com>
To: tutor@python.org
Sent: Sun, 1 Dec 2013 0:56
Subject: Re: [Tutor] empty delimiters, and None


On 11/29/2013 02:19 PM, uga...@talktalk.net wrote: 
> I have also looked at locale.py Line 494 of which is the last line of a def 
> (def function?) I include this below, hopefully this may save you searching 
> for locale.py (Pyhon 2.6) should you need it and wish to answer the above 
> questions, it may help. 
> 
> def setlocale(category, locale=None): 
> 
>      """ Set the locale for the given category.  The locale can be 
>          a string, a locale tuple (language code, encoding), or None. 
> 
>          Locale tuples are converted to strings the locale aliasing 
>          engine.  Locale strings are passed directly to the C lib. 
> 
>          category may be given as one of the LC_* values. 
> 
>      """ 
>      if locale and type(locale) is not type(""): 
>          # convert to string 
>          locale = normalize(_build_localename(locale)) 
>      return _setlocale(category, locale) 
 
As a side-note, in addition to what other have said, the headline of the 
function def 
 
    def setlocale(category, locale=None) 
 
says that None is the default (standard) value for the parameter 'locale'. This 
means that, if ever you provide no value for it when calling setlocale, then 
the value None is used in standard. So, you could as well call it like: 
 
    locale.setlocale(locale.LC_ALL)     # no value at all for param 'locale' 
 
instead of you correction 
 
    locale.setlocale(locale.LC_ALL, None) 
 
for the initial version 
 
    locale.setlocale(locale.LC_ALL, '') 
 
This is actually good coding practice (in all language which have default 
values). 
 
Denis 
_______________________________________________ 
Tutor maillist  -  Tutor@python.org 
To unsubscribe or change subscription options: 
https://mail.python.org/mailman/listinfo/tutor 

 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to