This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Anthony Sottile, barry, gregory.p.smith, jwilk, miss-islington, nascheme, njs, rhettinger, serhiy.storchaka, steven.daprano, user30111, vstinner, xiang.zhang
Date 2019-06-10.02:02:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>

to respond to the substance of your comments: it is not the *primary* 
purpose of a compiler to teach, but compiler warnings on potentially 
wrong behaviour is a long-standing tradition in many languages, 
including Python.

This is not the first such warning in Python: it has warned on incorrect 
assertions for a few releases now:

py> assert (flag, "error")
<stdin>:1: SyntaxWarning: assertion is always true, perhaps remove parentheses?

Ideally a language should have no warts, gotchas or features which are 
easy to misuse, but in practice that's not the case. Identity testing in 
Python is, unfortunately, one of those features which are easy to 
misuse, and it has real consequences.

If you go back to the very first post in the discussion which launched 
this feature, Gregory points out that PyPy had to change their behaviour 
to work around so many bugs in Python code from people wrongly using 
identity tests over equality.

As the Zen says, "practicality beats purity" and this is a low-impact 
change with no runtime cost that we expect will nevertheless help catch 
many logical errors.

Apart from your aesthetic sense that the compiler shouldn't try to 
educate users into using correct code rather than wrong code that works 
by accident, do you have any objections to this feature?

Evidence of code that breaks because of this change is especially 
Date User Action Args
2019-06-10 02:02:15steven.dapranosetrecipients: + steven.daprano, barry, nascheme, rhettinger, gregory.p.smith, vstinner, jwilk, njs, serhiy.storchaka, xiang.zhang, Anthony Sottile, miss-islington, user30111
2019-06-10 02:02:15steven.dapranolinkissue34850 messages
2019-06-10 02:02:15steven.dapranocreate