From: Fred Drake Date: Tue, 24 Sep 2002 13:57:32 +0000 (+0000) Subject: Clarify that len() of a Unicode string returns the number of storage units, X-Git-Tag: v2.2.2b1~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f3c65422d6a2309d84dfdc0698d7825bc9063f9;p=thirdparty%2FPython%2Fcpython.git Clarify that len() of a Unicode string returns the number of storage units, not abstract characters. --- diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index fc00dd4197d6..e47e01e8def8 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -526,6 +526,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}}