Aug. 31, 2021
12:01 a.m.
On Tue, Aug 31, 2021 at 8:54 AM Nick Parlante <nick@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