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: `1` => `True`; for tutorial docs
Type: enhancement Stage:
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: SamuelMarks, docs@python, ezio.melotti, python-dev, rhettinger, terry.reedy
Priority: normal Keywords: patch

Created on 2014-03-22 01:59 by SamuelMarks, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Use_`True`_instead_of_`1`_.patch SamuelMarks, 2014-03-22 01:59
Repositories containing patches
http://hg.python.org/cpython
Messages (5)
msg214430 - (view) Author: Samuel Marks (SamuelMarks) * Date: 2014-03-22 01:59
Particularly for new programmers `True` makes more sense than `1` when doing boolean logic.

If you aren't going to accept this patch; at least add in a sentence explaining that: `> 1 == True`.

Best,

Samuel Marks
msg214602 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-03-23 16:36
In Python 2.7, we're not changing all the "1" to "True" because that aren't quite the same (True is a global and not a builtin constant).

If you see these in 3.x, we should change them all :-)
msg215083 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-03-28 22:19
Raymond, what I think you meant is that in 2.x, 'True' is a builtin name that can be shadowed by a user assignment "True = 'not true'" whereas in 3.x it is a keyword name like None that cannot be changed ("None = 'some'" fails even in 2.7).

I checked and the patch is needed in 3.4 and (I presume) 3.5.
msg215096 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-28 23:39
New changeset deb71529aad1 by Raymond Hettinger in branch '3.4':
Issue 21014:  Use booleans instead of 0 and 1 in examples.
http://hg.python.org/cpython/rev/deb71529aad1
msg215097 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-03-28 23:43
Samuel, thanks for the patch.   And, Terry, thanks for looking at it.

Applied the first two changes to 3.4 and 3.5.  Skipped, the third suggested change in introduction.rst.  That was not a boolean example, it was just the number 1 in a section about how comments work, so it shouldn't change.
History
Date User Action Args
2022-04-11 14:58:00adminsetgithub: 65213
2014-03-28 23:43:19rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg215097
2014-03-28 23:39:57python-devsetnosy: + python-dev
messages: + msg215096
2014-03-28 22:19:15terry.reedysetnosy: + terry.reedy

messages: + msg215083
versions: + Python 3.4, Python 3.5, - Python 2.7
2014-03-23 16:36:37rhettingersetassignee: docs@python -> rhettinger

messages: + msg214602
nosy: + rhettinger
2014-03-22 11:41:49berker.peksagsetnosy: + ezio.melotti
2014-03-22 01:59:16SamuelMarkscreate