The 'is' operator can't be used for comparisons except in specific cases. Currently the if is always False.
CPython 3.8 added a SyntaxWarning for cases where the usage is definitely wrong.
Details
- Reviewers
rsmith
Diff Detail
- Repository
- rC Clang
Event Timeline
Gentle ping ... ArchLinux update to Python 3.8 and it's not possible to use clang-format.py from vim anymore.
Thanks
This is not a language change in Python 3.8. AFAICT, the behaviour of is has been the same as long as Python has been in use.
CPython 3.8 only added the warning for incorrect usages where the result is always False, as in this case.
It's unclear to me why @j-carl thinks this change might resolve this. This behaviour should be consistent across at least Python 2.7–3.8.
I'm also unsure why this has yet to be reviewed and how might I get someone to do that.
As @tambre mentioned it's not a language change, but information about the change can be found here https://bugs.python.org/issue34850.
The problem I face with the vim integration is that vim stops the execution of the script and shows a warning:
/usr/share/clang/clang-format.py:123: SyntaxWarning: "is not" with a literal. Did you mean "!="? if op[0] is not 'equal': Press ENTER or type command to continue
Now I have to press ENTER to get the script running. This adds another key stroke to my workflow.