summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libstring.tex
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-07-13 02:06:47 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-07-13 02:06:47 (GMT)
commit5c5fca9844a5aa7b56ca45fe324491cb2b43a7cd (patch)
treec982f3df56dd0077ff1225f8a73676d15451feab /Doc/lib/libstring.tex
parent1d8d729af80c7d45161f20a40428d26698c11af8 (diff)
downloadcpython-5c5fca9844a5aa7b56ca45fe324491cb2b43a7cd.zip
cpython-5c5fca9844a5aa7b56ca45fe324491cb2b43a7cd.tar.gz
cpython-5c5fca9844a5aa7b56ca45fe324491cb2b43a7cd.tar.bz2
SF bug #706546: u''.translate not documented
Clarified the difference between translate methods for string objects and Unicode objects.
Diffstat (limited to 'Doc/lib/libstring.tex')
-rw-r--r--Doc/lib/libstring.tex12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/lib/libstring.tex b/Doc/lib/libstring.tex
index a4823d9..f017aa8 100644
--- a/Doc/lib/libstring.tex
+++ b/Doc/lib/libstring.tex
@@ -276,7 +276,17 @@ parameter cannot be passed in earlier 2.2 versions]{2.2.3}
Delete all characters from \var{s} that are in \var{deletechars} (if
present), and then translate the characters using \var{table}, which
must be a 256-character string giving the translation for each
- character value, indexed by its ordinal.
+ character value, indexed by its ordinal.
+
+ For Unicode objects, the \method{translate()} method does not
+ accept the optional \var{deletechars} argument. Instead, it
+ returns a copy of the \var{s} where all characters have been mapped
+ through the given translation table which must be a mapping of
+ Unicode ordinals to Unicode ordinals, Unicode strings or \code{None}.
+ Unmapped characters are left untouched. Characters mapped to \code{None}
+ are deleted. Note, a more flexible approach is to create a custom
+ character mapping codec using the \refmodule{codecs} module (see
+ \module{encodings.cp1251} for an example).
\end{funcdesc}
\begin{funcdesc}{upper}{s}