Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
416ecffc
Commit
416ecffc
authored
Nov 05, 2011
by
Petri Lehtinen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #3067: Enhance the documentation and docstring of locale.setlocale()
parent
49aa72ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
Doc/library/locale.rst
Doc/library/locale.rst
+10
-10
Lib/locale.py
Lib/locale.py
+3
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/locale.rst
View file @
416ecffc
...
...
@@ -23,19 +23,19 @@ The :mod:`locale` module defines the following exception and functions:
.. exception:: Error
Exception raised when :func:`setlocale` fails.
Exception raised when the locale passed to :func:`setlocale` is not
recognized.
.. 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 or ``None``, the current setting for *category* is
returned.
...
...
@@ -51,7 +51,7 @@ The :mod:`locale` module defines the following exception and functions:
changed thereafter, using multithreading should not cause problems.
.. versionchanged:: 2.0
Added support for
tup
le values of the *locale* parameter.
Added support for
iterab
le values of the *locale* parameter.
.. function:: localeconv()
...
...
Lib/locale.py
View file @
416ecffc
...
...
@@ -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.
a string, an iterable of two strings (language code and encoding),
or None.
Locale tuples are converted to strings
the locale aliasing
Iterables are converted to strings using
the locale aliasing
engine. Locale strings are passed directly to the C lib.
category may be given as one of the LC_* values.
...
...
Misc/NEWS
View file @
416ecffc
...
...
@@ -74,6 +74,9 @@ Core and Builtins
Library
-------
-
Issue
#
3067
:
Enhance
the
documentation
and
docstring
of
locale
.
setlocale
().
-
Issue
#
13254
:
Fix
Maildir
initialization
so
that
maildir
contents
are
read
correctly
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment