This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: str.expandtabs documentation is wrong
Type: Stage:
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eli.bendersky, john.feuerstein, python-dev
Priority: normal Keywords: patch

Created on 2011-11-07 14:23 by john.feuerstein, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
expandtabs_doc.diff john.feuerstein, 2011-11-07 14:23 review
Messages (5)
msg147222 - (view) Author: John Feuerstein (john.feuerstein) * Date: 2011-11-07 14:23
The documentation for str.expandtabs([tabsize]) is wrong:
 
"Return a copy of the string where all tab characters are replaced by one or more spaces, depending on the current column and the given tab size. [...]"

This should read "zero or more spaces":

>>> 'a\tb'.expandtabs(0)
'ab'
>>> 'a\tb'.expandtabs(-1)
'ab'

The description in Objects/unicodeobject.c does not include this error.
msg147224 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-07 14:47
While we're at it, wouldn't it be clearer to say "... where each tab character is replaced by..."?
msg147225 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-07 14:50
Other than that, the patch looks good.
msg147420 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-11 08:34
New changeset 84f803fdc0d2 by Eli Bendersky in branch '3.2':
Issue #13365: correct an error in the documentation of str.expandtabs
http://hg.python.org/cpython/rev/84f803fdc0d2

New changeset 25191fe10da9 by Eli Bendersky in branch 'default':
Issue #13365: correct an error in the documentation of str.expandtabs. Patch by John Feuerstein
http://hg.python.org/cpython/rev/25191fe10da9
msg147421 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-11-11 08:35
Committed. Thanks for contributing.
History
Date User Action Args
2022-04-11 14:57:23adminsetgithub: 57574
2011-11-11 08:35:19eli.benderskysetstatus: open -> closed

messages: + msg147421
2011-11-11 08:34:53python-devsetnosy: + python-dev
messages: + msg147420
2011-11-07 14:50:07eli.benderskysetmessages: + msg147225
2011-11-07 14:47:08eli.benderskysetnosy: + eli.bendersky
messages: + msg147224
2011-11-07 14:23:05john.feuersteincreate