bpo-36781: Optimize sum() for bools.#13074
Merged
DinoV merged 4 commits intopython:masterfrom Sep 10, 2019
Merged
Conversation
rhettinger
approved these changes
May 4, 2019
pppery
reviewed
May 5, 2019
| continue; | ||
| } | ||
| if (PyLong_CheckExact(item)) { | ||
| if (PyLong_Check(item)) { |
There was a problem hiding this comment.
Why is this not PyLong_CheckExact(item) || PyBool_Check(item) like the one above?
Member
Author
There was a problem hiding this comment.
Because why not? This extends the optimization to other int subclasses.
There is a reason why PyLong_Check(item) is not used above: because __radd__ method in the int subclass takes precedence. But for float+int it is not used.
MojoVampire
reviewed
May 5, 2019
DinoV
approved these changes
Sep 10, 2019
|
@DinoV: Please replace |
websurfer5
pushed a commit
to websurfer5/cpython
that referenced
this pull request
Jul 20, 2020
* Optimize sum() for bools. * Fix sum([], False). * Add a NEWS entry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue36781