cpython: 34c9465f5023 (original) (raw)
Mercurial > cpython
changeset 73372:34c9465f5023 2.7
Issue #3067: Enhance the documentation and docstring of locale.setlocale() [#3067]
Petri Lehtinen petri@digip.org | |
---|---|
date | Sat, 05 Nov 2011 10🔞50 +0200 |
parents | 0b754ee12dbd |
children | 8ea34a74f118 |
files | Doc/library/locale.rst Lib/locale.py Misc/NEWS |
diffstat | 3 files changed, 16 insertions(+), 12 deletions(-)[+] [-] Doc/library/locale.rst 20 Lib/locale.py 5 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Doc/library/locale.rst
+++ b/Doc/library/locale.rst
@@ -23,19 +23,19 @@ The :mod:locale
module defines the fol
.. exception:: Error
.. function:: setlocale(category[, locale])
- If locale is specified, it may be a string, a tuple of the form ``(language
- code, encoding)
, or
None``. If it is a tuple, it is converted to a string - using the locale aliasing engine. If locale is given and not
None
, - :func:
setlocale
modifies the locale setting for the category. The available - categories are listed in the data description below. The value is the name of a
- locale. An empty string specifies the user's default settings. If the
- modification of the locale fails, the exception :exc:
Error
is raised. If - successful, the new locale setting is returned.
- If locale is given and not
None
, :func:setlocale
modifies the locale - setting for the category. The available categories are listed in the data
- description below. locale may be a string, or an iterable of two strings
- (language code and encoding). If it's an iterable, it's converted to a locale
- name using the locale aliasing engine. An empty string specifies the user's
- default settings. If the modification of the locale fails, the exception
- :exc:
Error
is raised. If successful, the new locale setting is returned. If locale is omitted orNone
, the current setting for category is returned. @@ -51,7 +51,7 @@ The :mod:locale
module defines the fol changed thereafter, using multithreading should not cause problems. .. versionchanged:: 2.0
Added support for tuple values of the *locale* parameter.[](#l1.36)
Added support for iterable values of the *locale* parameter.[](#l1.37)
--- a/Lib/locale.py +++ b/Lib/locale.py @@ -524,9 +524,10 @@ def getlocale(category=LC_CTYPE): 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.[](#l2.7)
a string, an iterable of two strings (language code and encoding),[](#l2.8)
or None.[](#l2.9)
Locale tuples are converted to strings the locale aliasing[](#l2.11)
Iterables are converted to strings using the locale aliasing[](#l2.12) engine. Locale strings are passed directly to the C lib.[](#l2.13)
category may be given as one of the LC_* values.
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -74,6 +74,9 @@ Core and Builtins Library ------- +- Issue #3067: Enhance the documentation and docstring of