[issue34850] Emit a syntax warning for "is" with a literal
thautwarm
report at bugs.python.org
Thu Dec 19 08:39:18 EST 2019
thautwarm <yaoxiansamma at gmail.com> added the comment:
Thanks.
However, unfortunately, this warning seems impossible to suppress.
Use following example:
import warnings
warnings.filterwarnings('ignore')
warnings.warn(SyntaxWarning("test"))
def f(x):
return x is 5
print(f(5))
I succeeded in suppressing my own SyntaxWarning("test") , but the output is still:
python a.py
a.py:7: SyntaxWarning: "is" with a literal. Did you mean "=="?
return x is 5
True
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34850>
_______________________________________
More information about the Python-bugs-list
mailing list