I meant to post more of these, but here’s one for fun:
class A(object): def __eq__(self, rhs): return True class B(object): def __eq__(self, rhs): return False print A() in [B()] print B() in [A()]
Maybe not quite as surprising once you see the results and think about it, but getting this wrong was the source of some strange bugs in Pyston.