Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
Bachsau, 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. https://discuss.python.org/t/demoting-the-is-operator-to-avoid-an-identity-crisis/86 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 valuable. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34850> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com