gh-137668: Document that ord() supports also bytes and bytearray (GH-137669)

This commit is contained in:
Serhiy Storchaka 2025-08-13 12:12:16 +03:00 committed by GitHub
parent 639df39bf0
commit 35759fe2fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 9 deletions

View file

@ -1562,13 +1562,19 @@ are always available. They are listed here in alphabetical order.
.. versionchanged:: 3.11
The ``'U'`` mode has been removed.
.. function:: ord(c)
.. function:: ord(character, /)
Given a string representing one Unicode character, return an integer
representing the Unicode code point of that character. For example,
Return the ordinal value of a character.
If the argument is a one-character string, return the Unicode code point
of that character. For example,
``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign)
returns ``8364``. This is the inverse of :func:`chr`.
If the argument is a :class:`bytes` or :class:`bytearray` object of
length 1, return its single byte value.
For example, ``ord(b'a')`` returns the integer ``97``.
.. function:: pow(base, exp, mod=None)