summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-09-24 13:57:21 (GMT)
committerFred Drake <fdrake@acm.org>2002-09-24 13:57:21 (GMT)
commit7b788e0582e3b9b92634b6955fb4fa39f0b1428f (patch)
tree67e14e3165441aa4b98f1169fc4b7d23cdf45b81
parent24e53b6d919ccb1c35286701fd39e8eb10a50282 (diff)
downloadcpython-7b788e0582e3b9b92634b6955fb4fa39f0b1428f.zip
cpython-7b788e0582e3b9b92634b6955fb4fa39f0b1428f.tar.gz
cpython-7b788e0582e3b9b92634b6955fb4fa39f0b1428f.tar.bz2
Clarify that len() of a Unicode string returns the number of storage units,
not abstract characters.
-rw-r--r--Doc/lib/libfuncs.tex4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 4a0efdb..491e0fe 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -568,6 +568,10 @@ def my_import(name):
\begin{funcdesc}{len}{s}
Return the length (the number of items) of an object. The argument
may be a sequence (string, tuple or list) or a mapping (dictionary).
+ In the case of Unicode strings, \function{len()} returns the number
+ of storage units, not abstract characters. In particular, when a
+ surrogate pair is encountered, each component of the pair is counted
+ as a separate character.
\end{funcdesc}
\begin{funcdesc}{list}{\optional{sequence}}