GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-151128: Improve SyntaxError message for cross language keywords by zang-langyan · Pull Request #151129 · python/cpython Conversation
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
edvilme
reviewed
Comment on lines
+1890
to
+1891
This comment was marked as resolved.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can split this on two features -- for keywords and for operators. Anyway, it needs a NEWS entry, a What's New entry, and tests.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. This is actually a different feature. You can even open a separate issue and PR for this (if there is no already open). Anyway, this is a nice improvement. I suggest to add also cases for
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually there is already a PR for improving SyntaxError message of && and ||: #150906
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for review, great suggestion, I will add those~
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then let's focus on keywords in this PR.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
IvyXu420
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe we should add softkwlist here too?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add also tests for soft keywords? And document this change in the NEWS entry. Why aliases for None were removed? Were there issues with them?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Sure, I will add the tests for soft keywords. I removed the aliases for None because I realized that names like Null, nil, etc. don't work well for keyword syntax detection. I can't think of a situation where these tokens would be correctly identified as keywords. Any suggestions? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You are right. Maybe they can be handled where NameError is handed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| max_matches = 3 | ||
| matches = [] | ||
|
|
||
| hint = _get_cross_language_keyword_hint(wrong_name) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| hint = _get_cross_language_keyword_hint(wrong_name) | |
| hint = _CROSS_LANGUAGE_KEYWORD_HINTS.get(wrong_name) |
If it is only used once, and is marked as a "private" method, I would suggest calling the body directly
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this. I still think a get method looks nicer..
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.