Title: str.translate docstring doesn't mention that 'table' can be None
Type: Stage:
Components: Documentation Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: docs@python, mark.dickinson, petri.lehtinen, python-dev
Priority: normal Keywords: patch

Created on 2011-05-24 05:14 by mark.dickinson, last changed 2011-06-25 09:01 by mark.dickinson. This issue is now closed.

File name Uploaded Description Edit
str_translate_docstring.patch petri.lehtinen, 2011-05-26 06:49 Fix docstring of str.translate
str_translate_docstring_2.patch petri.lehtinen, 2011-05-31 11:01 Different wording
Messages (6)
msg136720 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-05-24 05:14
In Python 2.6 and 2.7, str.translate accepts None as a first argument.  That's documented in the docs, but not in the str.translate docstring.
msg137353 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-05-31 09:45
I added a patch a few days ago. How does it look?
msg137356 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-05-31 11:01
After discussing with Ezio Melotti, I attached another patch with a different wording.

Mark: As a native English speaker, which one you prefer?
msg137645 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-06-04 14:54
Thanks for the patches!  Here's a slight expansion of the wording on your second patch:

 Return a copy of the string S, where all characters occurring
 in the optional argument deletechars are removed, and the
 remaining characters have been mapped through the given
 translation table, which must be a string of length 256 or None.
 If the table argument is None, no translation is applied and
 the translation simply removes the characters in deletechars.

What do you think?
msg137657 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-06-04 18:08
> What do you think?

Sounds very good to my native Finnish ears :)
msg139028 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-06-25 09:00
New changeset 60b3a5615c4e by Mark Dickinson in branch '2.7':
Issue #12164: Document (in docstring) that str.translate accepts None for the first argument.
Date User Action Args
2011-06-25 09:01:08mark.dickinsonsetstatus: open -> closed
resolution: accepted -> fixed
2011-06-25 09:00:19python-devsetnosy: + python-dev
messages: + msg139028
2011-06-04 18:21:34rhettingersetresolution: accepted
2011-06-04 18:08:50petri.lehtinensetmessages: + msg137657
2011-06-04 14:54:44mark.dickinsonsetassignee: docs@python -> mark.dickinson
messages: + msg137645
2011-05-31 11:01:36petri.lehtinensetfiles: + str_translate_docstring_2.patch

messages: + msg137356
2011-05-31 09:45:42petri.lehtinensetmessages: + msg137353
2011-05-26 06:49:53petri.lehtinensetfiles: + str_translate_docstring.patch
nosy: + petri.lehtinen
keywords: + patch
2011-05-24 05:14:44mark.dickinsoncreate