-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Exactly same check multiple times in if statement #42828
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
Conversation
gcaria
commented
Jul 30, 2021
- closes BUG: Exactly same check multiple times in if statement #42781
- Ensure all linting tests pass, see here for how to run them
@@ -3534,7 +3534,7 @@ def _union(self, other, sort) -> MultiIndex: | |||
other, result_names = self._convert_can_do_setop(other) | |||
if ( | |||
any(-1 in code for code in self.codes) | |||
and any(-1 in code for code in self.codes) | |||
and any(-1 in code for code in other.codes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great can you see if you can find a test that fails for this w/o the change and passes with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not since this is mostly performance relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would explain why there is no bug associated with this mistyping. Does panda
use also performance testing/checking too? Happy to add such test if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and while we are rewriting, any reason
self.codes.any()
is not used? generally more performant and more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could we check for -1 with any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right, this is not a null check, ok then.
thanks @gcaria |