-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-45843: Optimize constant comparisons/contains #29639
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
bpo-45843: Optimize constant comparisons/contains #29639
Conversation
Thanks for the really impressive compiler work. I hope I understand the code correctly. It's effectively doing constant folding for comparison expressions where both sides are consts right? So
to
My question is how common do people write things like |
I was surprised that this isn't handled by the AST optimizer. @thatbirdguythatuknownot could you implement this in the AST optimizer? |
I suspect that no one would write if 0:
sensitive_internal_debugging_code is removed from the bytecode. So this is probably worth doing from a consistency point of view, even if it makes no difference in terms of performance. |
@markshannon Should I revert the changes made to |
I don't understand why you need all the extra code. All you need to do in |
@markshannon Do I |
…nctions to be specialized (pythonGH-29595)
Closing since this issue got rejected on the bug tracker. |
https://bugs.python.org/issue45843