Swap 'if' branches so content matches to condition in importlib example#14947
Merged
Merged
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.
Member
|
cc: @brettcannon |
brettcannon
approved these changes
Jul 25, 2019
Contributor
|
@uranusjr: Status check is done, and it's a success ✅ . |
Contributor
|
Thanks @uranusjr for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 25, 2019
…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. |
miss-islington
added a commit
that referenced
this pull request
Jul 25, 2019
…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>
lisroach
pushed a commit
to lisroach/cpython
that referenced
this pull request
Sep 10, 2019
…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
DinoV
pushed a commit
to DinoV/cpython
that referenced
this pull request
Jan 14, 2020
…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
websurfer5
pushed a commit
to websurfer5/cpython
that referenced
this pull request
Jul 20, 2020
…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
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.
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