On Tue, Aug 31, 2021 at 8:54 AM Nick Parlante <n...@cs.stanford.edu> wrote: > > I agree that, of course, it's possible to construct a class where == has this > kind of weird behavior, like claiming that == to None is True. > > So are you saying that the reason PEP8 should forbid writing the line like > this > > if x == None: > > is because x might be such a class? >
Yes, among other reasons. That's why identity checks are *the only correct way* to check for the identity of something. Equality is not a substitute. ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/EBBKJ2BEW4FSTBI7KJIE5CZGZHQUYCL6/ Code of Conduct: http://python.org/psf/codeofconduct/