]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Clarify that len() of a Unicode string returns the number of storage units,
authorFred Drake <fdrake@acm.org>
Tue, 24 Sep 2002 13:57:32 +0000 (13:57 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 24 Sep 2002 13:57:32 +0000 (13:57 +0000)
not abstract characters.

Doc/lib/libfuncs.tex

index fc00dd4197d604092d2980db7684336e96109f9c..e47e01e8def8a5e1390c139ba2c1d684d47707ad 100644 (file)
@@ -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}}