@@ -1422,38 +1422,10 @@ are always available. They are listed here in alphabetical order.
14221422
14231423 *errors * is an optional string that specifies how encoding and decoding
14241424 errors are to be handled—this cannot be used in binary mode.
1425- A variety of standard error handlers are available
1426- (listed under :ref: `error-handlers `), though any
1427- error handling name that has been registered with
1425+ A variety of standard error handlers are available,
1426+ though any error handling name that has been registered with
14281427 :func: `codecs.register_error ` is also valid. The standard names
1429- include:
1430-
1431- * ``'strict' `` to raise a :exc: `ValueError ` exception if there is
1432- an encoding error. The default value of ``None `` has the same
1433- effect.
1434-
1435- * ``'ignore' `` ignores errors. Note that ignoring encoding errors
1436- can lead to data loss.
1437-
1438- * ``'replace' `` causes a replacement marker (such as ``'?' ``) to be inserted
1439- where there is malformed data.
1440-
1441- * ``'surrogateescape' `` will represent any incorrect bytes as low
1442- surrogate code units ranging from U+DC80 to U+DCFF.
1443- These surrogate code units will then be turned back into
1444- the same bytes when the ``surrogateescape `` error handler is used
1445- when writing data. This is useful for processing files in an
1446- unknown encoding.
1447-
1448- * ``'xmlcharrefreplace' `` is only supported when writing to a file.
1449- Characters not supported by the encoding are replaced with the
1450- appropriate XML character reference :samp: `&#{ nnn } ; `.
1451-
1452- * ``'backslashreplace' `` replaces malformed data by Python's backslashed
1453- escape sequences.
1454-
1455- * ``'namereplace' `` (also only supported when writing)
1456- replaces unsupported characters with ``\N{...} `` escape sequences.
1428+ can be found in :ref: `error-handlers `.
14571429
14581430 .. index ::
14591431 single: universal newlines; open() built-in function
@@ -1562,13 +1534,19 @@ are always available. They are listed here in alphabetical order.
15621534 .. versionchanged :: 3.11
15631535 The ``'U' `` mode has been removed.
15641536
1565- .. function :: ord(c )
1537+ .. function :: ord(character, / )
15661538
1567- Given a string representing one Unicode character, return an integer
1568- representing the Unicode code point of that character. For example,
1539+ Return the ordinal value of a character.
1540+
1541+ If the argument is a one-character string, return the Unicode code point
1542+ of that character. For example,
15691543 ``ord('a') `` returns the integer ``97 `` and ``ord('€') `` (Euro sign)
15701544 returns ``8364 ``. This is the inverse of :func: `chr `.
15711545
1546+ If the argument is a :class: `bytes ` or :class: `bytearray ` object of
1547+ length 1, return its single byte value.
1548+ For example, ``ord(b'a') `` returns the integer ``97 ``.
1549+
15721550
15731551.. function :: pow(base, exp, mod=None)
15741552
0 commit comments