Issue 706546: u''.translate not documented (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/38184

classification

Title: u''.translate not documented
Type: Stage:
Components: Documentation Versions:

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: josharian, lemburg, mjpieters, rhettinger
Priority: normal Keywords:

Created on 2003-03-19 21:35 by mjpieters, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (6)
msg15207 - (view) Author: Martijn Pieters (mjpieters) * Date: 2003-03-19 21:35
The behaviour of u''.translate is significantly different from ''.translate, yet the difference is not reflected in the documentation. - ''.translate takes one or two arguments, one a table of 256 characters for the translation target and the other a string containing characters to be removed. - u''.translate only takes on argument, which is a mapping from unicode ordinal to unicode ordinal, ustring or None. See also print u''.translate.__doc__
msg15208 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2003-03-20 09:15
Logged In: YES user_id=38388 Isn't the documentation clear enough about the difference ? Note that u.translate() is not really all that useful. You are much better off with writing your own charmap based codec which is not really difficult: just take a look at e.g. cp1251.py.
msg15209 - (view) Author: Martijn Pieters (mjpieters) * Date: 2003-03-20 14:26
Logged In: YES user_id=116747 No, the documentation on u''.translate is *not present*. The Python Library Reference makes no mention of a difference. See: http://www.python.org/doc/current/lib/string-methods.html I don't really care how it is of little use, I just need the documentation to be up to date so I don't have to scratch my head why I get this weird error that translate only takes one argument; as it turns out the strings I was calling this on were unicode strings.
msg15210 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2003-03-20 17:53
Logged In: YES user_id=38388 I see. In that case, I'd suggest you provide a patch to fill up the gaps. Thanks.
msg15211 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-07-13 02:07
Logged In: YES user_id=80475 Added the requested clarification. See Doc/lib/libstring.tex 1.51
msg147787 - (view) Author: Joshua Bleecher Snyder (josharian) Date: 2011-11-17 01:39
This documentation change didn't make it into the docs for translate in the string module -- see http://docs.python.org/library/string.html. It'd be great to add it there as well, as I just got bitten by this. :)
History
Date User Action Args
2022-04-10 16:07:47 admin set github: 38184
2011-11-17 01:39:03 josharian set nosy: + josharianmessages: +
2003-03-19 21:35:41 mjpieters create