@@ -1487,17 +1487,21 @@ These are the mapping codec APIs:
1487
1487
1488
1488
The following codec API is special in that maps Unicode to Unicode.
1489
1489
1490
- .. c :function :: PyObject* PyUnicode_Translate (PyObject *unicode, \
1491
- PyObject *mapping, const char *errors)
1490
+ .. c :function :: PyObject* PyUnicode_Translate (PyObject *str, PyObject *table, const char *errors)
1492
1491
1493
- Translate a Unicode object using the given * mapping * object and return the
1494
- resulting Unicode object. Return ``NULL `` if an exception was raised by the
1492
+ Translate a string by applying a character mapping table to it and return the
1493
+ resulting Unicode object. Return ``NULL `` if an exception was raised by the
1495
1494
codec.
1496
1495
1497
- The *mapping * object must map Unicode ordinal integers to Unicode strings,
1498
- integers (which are then interpreted as Unicode ordinals) or ``None``
1499
- (causing deletion of the character). Unmapped character ordinals (ones
1500
- which cause a :exc: `LookupError `) are left untouched and are copied as-is.
1496
+ The mapping table must map Unicode ordinal integers to Unicode ordinal integers
1497
+ or ``None `` (causing deletion of the character).
1498
+
1499
+ Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1500
+ and sequences work well. Unmapped character ordinals (ones which cause a
1501
+ :exc: `LookupError `) are left untouched and are copied as-is.
1502
+
1503
+ *errors* has the usual meaning for codecs. It may be ``NULL`` which indicates to
1504
+ use the default error handling.
1501
1505
1502
1506
1503
1507
.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, \
@@ -1600,23 +1604,6 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
1600
1604
characters are not included in the resulting strings.
1601
1605
1602
1606
1603
- .. c :function :: PyObject* PyUnicode_Translate (PyObject *str, PyObject *table, \
1604
- const char *errors)
1605
-
1606
- Translate a string by applying a character mapping table to it and return the
1607
- resulting Unicode object.
1608
-
1609
- The mapping table must map Unicode ordinal integers to Unicode ordinal integers
1610
- or ``None `` (causing deletion of the character).
1611
-
1612
- Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1613
- and sequences work well. Unmapped character ordinals (ones which cause a
1614
- :exc: `LookupError `) are left untouched and are copied as-is.
1615
-
1616
- *errors* has the usual meaning for codecs. It may be ``NULL`` which indicates to
1617
- use the default error handling.
1618
-
1619
-
1620
1607
.. c :function :: PyObject* PyUnicode_Join (PyObject *separator, PyObject *seq)
1621
1608
1622
1609
Join a sequence of strings using the given *separator * and return the resulting
0 commit comments