10000 gh-100556: Better `or` doc wording by ramvikrams · Pull Request #100589 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100556: Better or doc wording #100589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update stdtypes.rst
  • Loading branch information
ramvikrams committed Dec 29, 2022
commit 985f3fdaddd2d582c71196d5ae75282fc93dbb73
6 changes: 3 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ These are the Boolean operations, ordered by ascending priority:
+-------------+---------------------------------+-------+
| Operation | Result | Notes |
+=============+=================================+=======+
| ``x or y`` | if *x* is true, then *x*, else | \(1) |
| ``x or y`` | if *x* is True, then *x*, else | \(1) |
| | *y* | |
+-------------+---------------------------------+-------+
| ``x and y`` | if *x* is false, then *x*, else | \(2) |
| | *y* | |
| ``x and y`` | if *x* is True and *y* is True, | \(2) |
| | then True, else False | |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you misunderstood the other comment, as this now doesn't cover something like

>>> [] and [1]
[]

Copy link
Contributor Author
@ramvikrams ramvikrams Dec 30, 2022

Choose a reason for hiding this comment

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

could you please tell then how should it be framed, bcoz I am not able to think of it

Choose a reason for hiding this comment

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

if x and y, then True, else False

it covers if it's Null, empty, False...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks i'll do it

Copy link
Contributor

Choose a reason for hiding this comment

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

The original mention of 'true'/'false' refers to all truthy and falsey values, which include 0, None, empty lists, etc., and saying True excludes those as True refers to just the boolean value. I also don't think that it's all that helpful for a table to have an entry to say x and y then its explanation also say x and y, so I would actually recommend just sticking with the original for this and section.

+-------------+---------------------------------+-------+
| ``not x`` | if *x* is false, then ``True``, | \(3) |
| | else ``False`` | |
Expand Down
0