classification
Title: Built-in range docstrings are not PEP-8 compatible
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: docs@python, ezio.melotti, marco.buttu, python-dev, terry.reedy, tshepang
Priority: low Keywords: patch

Created on 2013-09-22 07:01 by marco.buttu, last changed 2013-10-05 21:41 by ezio.melotti. This issue is now closed.

Files
File name Uploaded Description Edit
rangeobject.patch marco.buttu, 2013-09-22 07:01 review
Messages (5)
msg198244 - (view) Author: Marco Buttu (marco.buttu) * Date: 2013-09-22 07:01
The range documentation is not PEP-8 compatible:

>>> range.__doc__.splitlines()[-1]
'Returns a virtual sequence of numbers from start to stop by step.'
>>> range.__reversed__.__doc__
'Returns a reverse iterator.'
>>> range.index.__doc__.splitlines()[-1]
'Raises ValueError if the value is not present.'

They should have been 'Return...' and 'Raise...'. Patch is attached
msg198547 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-09-28 20:17
PEP8 just says "PEP 257 describes good docstring conventions."
PEP 257 is what says '''It [the one line docstring] prescribes the function or method's effect as a command ("Do this", "Return that"), not as a description; e.g. don't write "Returns the pathname ...". '''

I strongly prefer the rule, but we do not usually patch purely for PEP8 compliance. However, a docstring patch is safer than a code patch.
msg198549 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-09-28 20:37
I asked on py-dev whether to do this.
#19068 and #19069 are similar issues for complex and float docstrings.
msg199005 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-05 21:40
New changeset 5135a431f7b3 by Ezio Melotti in branch '3.3':
#19067: use imperative mood in range object docstrings.  Patch by Marco Buttu.
http://hg.python.org/cpython/rev/5135a431f7b3

New changeset b2c752eff474 by Ezio Melotti in branch 'default':
#19067: merge with 3.3.
http://hg.python.org/cpython/rev/b2c752eff474
msg199006 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-10-05 21:41
Fixed, thanks for the patch!
History
Date User Action Args
2013-10-05 21:41:27ezio.melottisetstatus: open -> closed

assignee: docs@python -> ezio.melotti

nosy: + ezio.melotti
messages: + msg199006
resolution: fixed
stage: patch review -> resolved
2013-10-05 21:40:30python-devsetnosy: + python-dev
messages: + msg199005
2013-09-28 20:37:00terry.reedysetmessages: + msg198549
2013-09-28 20:17:15terry.reedysetversions: - Python 3.1
nosy: + terry.reedy

messages: + msg198547

stage: patch review
2013-09-28 04:38:03rhettingersetpriority: normal -> low
2013-09-28 03:46:35tshepangsetnosy: + tshepang
2013-09-22 07:01:15marco.buttucreate