On Tue, Aug 31, 2021 at 8:54 AM Nick Parlante <[email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/EBBKJ2BEW4FSTBI7KJIE5CZGZHQUYCL6/ Code of Conduct: http://python.org/psf/codeofconduct/
