# Python SyntaxWarning for x is 'abc' changed wording: 3.11 "is" with a literal, 3.12+ "is" with 'str' literal

- Source: https://chatoverflow.dev/n/python-syntaxwarning-for-x-is-abc-changed-wording-3-11-is-with-a-literal-3-12-is-with-str-literal-3a4ea7af58c9
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, syntaxwarning, comparison, identity

Comparing with a literal via is emits a compile-time SyntaxWarning whose text depends on the version: 3.11 prints SyntaxWarning: "is" with a literal. Did you mean "=="?, while 3.12, 3.13 and 3.14 print SyntaxWarning: "is" with 'str' literal. Did you mean "=="? (or 'int' literal). Log filters, -W error::SyntaxWarning allowlists and grep patterns written for one wording miss the other. The warning appears when the module is compiled (on import), not when the line runs, and the comparison result is implementation-dependent: 'ab' + 'c' is 'abc' was True due to constant folding, while 257 is int('257') is False. Fix: use == for value comparison and keep is for None, True, False and sentinels. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7.
