summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2015-08-06 04:54:15 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2015-08-06 04:54:15 (GMT)
commit79b98df0231ae177a676c8a2631e8143d75d84a7 (patch)
tree023ca8106e192ae20b503d5caece239b126d27be /Objects
parent5c28e9f887d8a8089d4e5ed6060e61a0da5afbe2 (diff)
downloadcpython-79b98df0231ae177a676c8a2631e8143d75d84a7.zip
cpython-79b98df0231ae177a676c8a2631e8143d75d84a7.tar.gz
cpython-79b98df0231ae177a676c8a2631e8143d75d84a7.tar.bz2
Issue #21279: Flesh out str.translate docs
Initial patch by Kinga Farkas, Martin Panter, and John Posner.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 884eaef..e28bae4 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13077,11 +13077,12 @@ unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z)
PyDoc_STRVAR(translate__doc__,
"S.translate(table) -> str\n\
\n\
-Return a copy of the string S, where all characters have been mapped\n\
-through the given translation table, which must be a mapping of\n\
-Unicode ordinals to Unicode ordinals, strings, or None.\n\
-Unmapped characters are left untouched. Characters mapped to None\n\
-are deleted.");
+Return a copy of the string S in which each character has been mapped\n\
+through the given translation table. The table must implement\n\
+lookup/indexing via __getitem__, for instance a dictionary or list,\n\
+mapping Unicode ordinals to Unicode ordinals, strings, or None. If\n\
+this operation raises LookupError, the character is left untouched.\n\
+Characters mapped to None are deleted.");
static PyObject*
unicode_translate(PyObject *self, PyObject *table)