Python/3: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with "== SyntaxWarning Literals == <blockquote> The compiler now produces a SyntaxWarning when identity checks (is and is not) are used with certain types of literals (e.g. strings, numbers). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (== and !=) instead. (Contributed by Serhiy Storchaka in bpo-34850.) </blockquote> https://docs.python.org/3.8/whatsnew/3.8.html#changes-in-python-be...")
 
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
</blockquote>
</blockquote>


https://docs.python.org/3.8/whatsnew/3.8.html#changes-in-python-behavior
https://docs.python.org/3.8/whatsnew/3.8.html#changes-in-python-behavior
 
https://github.com/python/cpython/issues/79031
 
https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/
 
== keywords ==

Latest revision as of 21:36, 18 July 2024

SyntaxWarning Literals

The compiler now produces a SyntaxWarning when identity checks (is and is not) are used with certain types of literals (e.g. strings, numbers). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (== and !=) instead. (Contributed by Serhiy Storchaka in bpo-34850.)

https://docs.python.org/3.8/whatsnew/3.8.html#changes-in-python-behavior
https://github.com/python/cpython/issues/79031
https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/

keywords