-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Coming from other languages, it’s easy to accidentally write && or || in place of and or or. I've even seen experienced people reach for them when doing boolean operations on Numpy arrays and the like.
It could be helpful to add a specialized syntax error. Something like:
File "<python-input-1>", line 1
a && b
^^
SyntaxError: invalid syntax. Maybe you meant 'and' or '&' instead of '&&'?This might be a little tricky, since && and || are not their own tokens, so I don't think this can be done at the grammar level.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-featureA feature request or enhancementA feature request or enhancement