diff options
author | Fred Drake <fdrake@acm.org> | 2005-08-23 04:33:29 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2005-08-23 04:33:29 (GMT) |
commit | b406905f333ee87b18d588c3c36d5c213ce262f9 (patch) | |
tree | aabb9cf0a44a54f663ceed0ef35c9b11bbd4592d /Doc | |
parent | 7ed44e52aa8a238bfbcb39d89df477e9bafc1837 (diff) | |
download | cpython-b406905f333ee87b18d588c3c36d5c213ce262f9.zip cpython-b406905f333ee87b18d588c3c36d5c213ce262f9.tar.gz cpython-b406905f333ee87b18d588c3c36d5c213ce262f9.tar.bz2 |
ord() documentation update; this is what remains applicable from
SF patch #1057588; other changes make the rest of the patch out of date
or otherwise unnecessary
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfuncs.tex | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 84b0ed5..feac346 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -716,11 +716,16 @@ class C: \end{funcdesc} \begin{funcdesc}{ord}{c} - Return the \ASCII{} value of a string of one character or a Unicode - character. E.g., \code{ord('a')} returns the integer \code{97}, + Given a string of length one, return an integer representing the + Unicode code point of the character when the argument is a unicode object, + or the value of the byte when the argument is an 8-bit string. + For example, \code{ord('a')} returns the integer \code{97}, \code{ord(u'\e u2020')} returns \code{8224}. This is the inverse of - \function{chr()} for strings and of \function{unichr()} for Unicode - characters. + \function{chr()} for 8-bit strings and of \function{unichr()} for unicode + objects. If a unicode argument is given and Python was built with + UCS2 Unicode, then the character's code point must be in the range + [0..65535] inclusive; otherwise the string length is two, and a + \exception{TypeError} will be raised. \end{funcdesc} \begin{funcdesc}{pow}{x, y\optional{, z}} |