summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-22 04:41:51 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-22 04:41:51 (GMT)
commitd028ca989a17321a976087aca78e0091c337800b (patch)
treeaae10500a36d1d6168151fe1b0830adcb4e61918 /Doc
parent0e13da904c9a6d3051027433ffa2c7b43c91cfb6 (diff)
downloadcpython-d028ca989a17321a976087aca78e0091c337800b.zip
cpython-d028ca989a17321a976087aca78e0091c337800b.tar.gz
cpython-d028ca989a17321a976087aca78e0091c337800b.tar.bz2
Fixed and extended the example; the original example contained some
bogus code.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/liblocale.tex9
-rw-r--r--Doc/liblocale.tex9
2 files changed, 12 insertions, 6 deletions
diff --git a/Doc/lib/liblocale.tex b/Doc/lib/liblocale.tex
index c4c5506..6425797 100644
--- a/Doc/lib/liblocale.tex
+++ b/Doc/lib/liblocale.tex
@@ -184,9 +184,12 @@ Example:
\begin{verbatim}
>>> import locale
->>> locale.open(locale.LC_ALL,"de") #setting locale to German
->>> locale.strcoll("f\344n","foo") #comparing a string containing an umlaut
->>> can.close()
+>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
+>>> locale.setlocale(locale.LC_ALL, "de") # use German locale
+>>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut
+>>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
+>>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
+>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
\end{verbatim}
\subsection{Background, details, hints, tips and caveats}
diff --git a/Doc/liblocale.tex b/Doc/liblocale.tex
index c4c5506..6425797 100644
--- a/Doc/liblocale.tex
+++ b/Doc/liblocale.tex
@@ -184,9 +184,12 @@ Example:
\begin{verbatim}
>>> import locale
->>> locale.open(locale.LC_ALL,"de") #setting locale to German
->>> locale.strcoll("f\344n","foo") #comparing a string containing an umlaut
->>> can.close()
+>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
+>>> locale.setlocale(locale.LC_ALL, "de") # use German locale
+>>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut
+>>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
+>>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
+>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
\end{verbatim}
\subsection{Background, details, hints, tips and caveats}