-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Swap 'if' branches so content matches to condition in importlib example #14947
Swap 'if' branches so content matches to condition in importlib example #14947
Conversation
With the previous version, when I see `spec` referenced in the else block, I had to trace all the way back to the previous elif condition to find the assignment, and read the elif block again to make sure the variable is not changed inside. This implementation reads much more cleaner to me since `spec` is used immediately after it's introduced, and I no longer need to look it back up again after the elif block.
cc: @brettcannon |
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.
Me likey this 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.
👍 This reads cleaner
@uranusjr: Status check is done, and it's a success ✅ . |
Thanks @uranusjr for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
…le (pythonGH-14947) Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people. (Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.) Automerge-Triggered-By: @brettcannon (cherry picked from commit 544fa15) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
GH-14949 is a backport of this pull request to the 3.8 branch. |
…le (GH-14947) Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people. (Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.) Automerge-Triggered-By: @brettcannon (cherry picked from commit 544fa15) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
…le (pythonGH-14947) Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people. (Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.) Automerge-Triggered-By: @brettcannon
…le (pythonGH-14947) Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people. (Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.) Automerge-Triggered-By: @brettcannon
…le (pythonGH-14947) Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people. (Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.) Automerge-Triggered-By: @brettcannon
Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people.
(Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.)
Automerge-Triggered-By: @brettcannon