summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2014-08-17 04:07:53 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2014-08-17 04:07:53 (GMT)
commiteed671910f993571b2be137abbfafea105d4768f (patch)
treee7a7b540c1831ed45536964b30de576b1db81bfb /Doc/library/functions.rst
parente2953e514680496c8fb3062628df3c845c0a43c1 (diff)
downloadcpython-eed671910f993571b2be137abbfafea105d4768f.zip
cpython-eed671910f993571b2be137abbfafea105d4768f.tar.gz
cpython-eed671910f993571b2be137abbfafea105d4768f.tar.bz2
Clarify ord() and chr() documentation
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst19
1 files changed, 10 insertions, 9 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 2a89ce4..45f9cf5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -156,11 +156,13 @@ are always available. They are listed here in alphabetical order.
.. function:: chr(i)
- Return the string representing a character whose Unicode codepoint is the integer
- *i*. For example, ``chr(97)`` returns the string ``'a'``. This is the
- inverse of :func:`ord`. The valid range for the argument is from 0 through
- 1,114,111 (0x10FFFF in base 16). :exc:`ValueError` will be raised if *i* is
- outside that range.
+ Return the string representing a character whose Unicode codepoint is the
+ integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while
+ ``chr(12491)`` returns the string ``'ニ'``. This is the inverse of
+ :func:`ord`.
+
+ The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in
+ base 16). :exc:`ValueError` will be raised if *i* is outside that range.
.. function:: classmethod(function)
@@ -1056,13 +1058,12 @@ are always available. They are listed here in alphabetical order.
The ``'U'`` mode.
-.. XXX works for bytes too, but should it?
.. function:: ord(c)
Given a string representing one Unicode character, return an integer
- representing the Unicode code
- point of that character. For example, ``ord('a')`` returns the integer ``97``
- and ``ord('\u2020')`` returns ``8224``. This is the inverse of :func:`chr`.
+ representing the Unicode code point of that character. For example,
+ ``ord('a')`` returns the integer ``97`` and ``ord('ニ')`` returns
+ ``12491``. This is the inverse of :func:`chr`.
.. function:: pow(x, y[, z])