bpo-15248: Emit a compiler warning when missed a comma before tuple or list.#11757
Merged
serhiy-storchaka merged 4 commits intopython:masterfrom Feb 16, 2019
Merged
Conversation
eb9d418 to
ab03389
Compare
SylvainDe
reviewed
Feb 4, 2019
Contributor
SylvainDe
left a comment
There was a problem hiding this comment.
This looks very cool!
As an additional comment/question: would it make sense to move the logic generating the type description from the expr_ty into a function on its own to limit duplication ? I gave it a try at https://pastebin.com/XLZ2B7Cq (not tested whatsoever).
ab03389 to
cfe1a8d
Compare
cfe1a8d to
8e9dc9c
Compare
gvanrossum
approved these changes
Feb 15, 2019
Member
gvanrossum
left a comment
There was a problem hiding this comment.
Love this! Just some suggestions on the error messages.
| case JoinedStr_kind: | ||
| case FormattedValue_kind: | ||
| return compiler_warn(c, "'%.200s' object is not callable, " | ||
| "perhaps missed a comma?", |
Member
There was a problem hiding this comment.
“perhaps you missed a comma?”
Also use “;” instead of “,” on the previous line.
| case GeneratorExp_kind: | ||
| case Lambda_kind: | ||
| return compiler_warn(c, "'%.200s' object is not subscriptable, " | ||
| "perhaps missed a comma?", |
Member
Author
|
Thank you @SylvainDe! I also thought about this type of simplification, but was hesitant. I initially implemented this idea independently, but then I seen your nice variant and borrowed it. |
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/issue15248