-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138318, PyREPL: builtins should not be highlighted when used as attribute names #138319
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
Conversation
Signed-off-by: yihong0618 <[email protected]>
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.
I would actually say that the current behavior is more useful, since it allows users to see that they are typing in a keyword name and that there will be a syntax error because of that.
I am -1 on this change, sorry :(
not total agree before this patch I tried |
I am not against to stop highlighting |
That's their own choices. But writing the keyword and hitting enter would anyway raise a SyntaxError so I think it's better that users know that they are writing a keyword and that they can't do that. But I agree that the |
ghci
a.set and a.list the list highligt in VS Code is strange, I wonder it is the same in repl |
Nonetheless, while two core devs opposed changing the behavior for keywords, I'm willing to support a change of behavior when it comes to built-ins used as attributes. I think it makes sense not to highlight them. |
thank you |
Signed-off-by: yihong0618 <[email protected]>
now only not highlight the buildin words |
fixed that, thank you. |
Signed-off-by: yihong0618 <[email protected]>
Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst
Outdated
Show resolved
Hide resolved
Signed-off-by: yihong0618 <[email protected]>
Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst
Outdated
Show resolved
Hide resolved
Signed-off-by: yihong0618 <[email protected]>
Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst
Outdated
Show resolved
Hide resolved
Signed-off-by: yihong0618 <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
Signed-off-by: yihong0618 <[email protected]>
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.
I'll let REPL experts have a look in addition but thank you for the fix!
Thank you for your kindess review and @sobolevn learned a lot from this! |
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 looks good to me! Thanks for the PR @yihong0618
Thanks @yihong0618 for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
… as attribute names (pythonGH-138319) (cherry picked from commit 7a3bca5) Co-authored-by: yihong <[email protected]>
GH-138654 is a backport of this pull request to the 3.14 branch. |
…en used as attribute names (pythonGH-138319) (python#138654) pythongh-138318, PyREPL: builtins should not be highlighted when used as attribute names (pythonGH-138319) (cherry picked from commit 7a3bca5) Co-authored-by: yihong <[email protected]>
… as attribute names (python#138319)
We remove REPL highlighting when a builtin name is used as an attribute name. Keywords will still be highlighted as they can never be used as valid attribute names.
Previous discussion about keywords
as diff
before the patch:

after the patch:
after the disscuss