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: Use of '1' instead of 'True' as 'splitlines' argument in difflib documentation
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: docs@python, ezio.melotti, jayanthkoushik, nedbat, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2014-04-15 06:06 by jayanthkoushik, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (7)
msg216278 - (view) Author: Jayanth Koushik (jayanthkoushik) Date: 2014-04-15 06:10
In the difflib documentation, multiple uses of 'splitlines' use '1' as the 'keepends' argument. In Python 2.x, 1 is not guaranteed to be True and while this is guaranteed in 3.x, it would be much clearer to specify the argument as 'True'.
msg216804 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-18 20:55
In 2.x, 1 is guaranteed to be true, in that sense that
  if 1: print 'true'
is guaranteed to print 'true', while True is not necessarily true.
>>> True = 0
>>> if True: print 'yes'

>>>
So 2.x docs should not be changed.
msg216805 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-18 21:01
New changeset 604b74f9a07d by Terry Jan Reedy in branch '3.4':
Issue #21232: Replace .splitlines arg '1' with 'keepends=True'.
http://hg.python.org/cpython/rev/604b74f9a07d

New changeset c82dcad83438 by Terry Jan Reedy in branch 'default':
Merge with 3.4. Closes #21232.
http://hg.python.org/cpython/rev/c82dcad83438
msg216808 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2014-04-18 21:35
Although the OP was incorrect about 1 being guaranteed to be True, it is still better documentation to use True rather than 1 for a boolean argument.
msg216825 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-19 00:53
I believe that there have been discussions on this point and my memory is to leave 1 alone in 2.x docs. I could be mistaken though.
msg216920 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-04-20 23:03
I think that the general consensus is that changing the value of True and False is not supported, and the result of doing it is undefined, so I think Ned request is reasonable.
msg216924 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-20 23:54
If you want to backport, go ahead.
History
Date User Action Args
2022-04-11 14:58:01adminsetgithub: 65431
2014-04-20 23:54:15terry.reedysetmessages: + msg216924
2014-04-20 23:03:07ezio.melottisetnosy: + ezio.melotti
messages: + msg216920
2014-04-19 00:53:02terry.reedysetmessages: + msg216825
2014-04-18 21:35:46nedbatsetnosy: + nedbat
messages: + msg216808
2014-04-18 21:01:33python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg216805

resolution: fixed
stage: resolved
2014-04-18 20:55:23terry.reedysetassignee: docs@python -> terry.reedy
2014-04-18 20:55:12terry.reedysetnosy: + terry.reedy

messages: + msg216804
versions: - Python 3.1, Python 2.7, Python 3.2, Python 3.3
2014-04-15 06:10:31jayanthkoushiksetmessages: + msg216278
2014-04-15 06:06:37jayanthkoushikcreate