Skip to content

bpo-38738: Fix formatting of True and False.#17083

Merged
serhiy-storchaka merged 6 commits into
python:masterfrom
serhiy-storchaka:docs-format-return-bool
Nov 12, 2019
Merged

bpo-38738: Fix formatting of True and False.#17083
serhiy-storchaka merged 6 commits into
python:masterfrom
serhiy-storchaka:docs-format-return-bool

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Nov 7, 2019

Copy link
Copy Markdown
Member
  • "Return true/false" is replaced with "Return ``True``/``False``"
    if the function actually returns a bool.
  • Fixed formatting of some True and False literals (now in monospace).
  • Replaced "True/False" with "true/false" if it can be not only bool.
  • Replaced some 1/0 with True/False if it corresponds the code.

https://bugs.python.org/issue38738

* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.

@vsajip vsajip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve only the changes relating to the logging and venv packages, which I have commented on. I haven't reviewed the other changes.

Comment thread Doc/library/logging.rst Outdated
Comment thread Doc/library/logging.handlers.rst Outdated
Comment thread Doc/library/logging.rst Outdated
Comment thread Doc/library/venv.rst
Comment thread Doc/library/venv.rst

@aeros aeros left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @serhiy-storchaka, it covers a very large portion of the docs. Looks good for the most part, other than a few changes:

Comment thread Doc/library/dialog.rst
Comment thread Doc/library/sys.rst
Comment thread Doc/library/unittest.mock.rst Outdated
Comment thread Doc/library/unittest.mock.rst
Comment thread Doc/whatsnew/3.8.rst
Comment thread Doc/whatsnew/3.8.rst

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review, @aeros, but I disagree with all of your suggestions.

Comment thread Doc/library/dialog.rst
Comment thread Doc/library/sys.rst
Comment thread Doc/library/unittest.mock.rst Outdated
Comment thread Doc/library/unittest.mock.rst
Comment thread Doc/whatsnew/3.8.rst
Comment thread Doc/whatsnew/3.8.rst
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Thank you for your review @vsajip.

The build was failed because I forgot to update also susp-ignored.csv to match changes in the documentation.

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stdlib functions nearly always accept any true or false value for arguments used in a boolean context and specifically return True or False as specific boolean objects. I consider this a feature and approve of making the docs being worded accordingly. I looked at all the diffs and only have a couple of minor suggestions:

  1. Fix the default issue. (See my response on the unittest.mock discussion that included 'vedran'.)
  2. Maybe fix about 9 'Returns' and possibly other verbs.

Comment thread Doc/library/ipaddress.rst Outdated
Comment thread Doc/library/logging.rst Outdated
@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be put in the comfy chair!

@aeros

aeros commented Nov 9, 2019

Copy link
Copy Markdown
Contributor

@serhiy-storchaka

Thank you for your review, @aeros, but I disagree with all of your suggestions.

That's okay. Thanks for looking over the suggestions, I think the discussion provides some value either way.

I agree with the suggestions made by @terryjreedy, regarding the usage of consistently using imperative verbs to describe behavior.

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@vsajip, @terryjreedy: please review the changes made to this pull request.

@aeros aeros left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the are still some "Returns" that could be converted to "Return" (such as 389 of dataclasses.rst and 112 of fileinput.rst), but I approve of all of the changes made in the PR.

Thanks for the clarifications @serhiy-storchaka and @terryjreedy.

Comment thread Doc/library/dataclasses.rst Outdated
Comment thread Doc/library/fileinput.rst Outdated
Comment thread Doc/library/fileinput.rst Outdated
Comment thread Doc/library/fileinput.rst Outdated
Comment thread Doc/library/fileinput.rst Outdated
Comment thread Doc/library/gc.rst Outdated
Comment thread Doc/library/dataclasses.rst Outdated
serhiy-storchaka and others added 2 commits November 10, 2019 11:27
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Thank you @aeros! Added missed conversions.

Comment thread Doc/library/dialog.rst Outdated
@serhiy-storchaka serhiy-storchaka merged commit 138ccbb into python:master Nov 12, 2019
@serhiy-storchaka serhiy-storchaka deleted the docs-format-return-bool branch November 12, 2019 14:57
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 138ccbb02216ca086047c3139857fb44f3dab1f9 3.8

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry @serhiy-storchaka, I had trouble checking out the 3.7 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 138ccbb02216ca086047c3139857fb44f3dab1f9 3.7

@bedevere-bot

Copy link
Copy Markdown

GH-17125 is a backport of this pull request to the 3.8 branch.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 12, 2019
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>"..
(cherry picked from commit 138ccbb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Nov 12, 2019
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
(cherry picked from commit 138ccbb)
@bedevere-bot

Copy link
Copy Markdown

GH-17128 is a backport of this pull request to the 3.7 branch.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Nov 12, 2019
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>"..
(cherry picked from commit 138ccbb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Nov 12, 2019
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
(cherry picked from commit 138ccbb)
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
@serhiy-storchaka serhiy-storchaka removed their assignment Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants