Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In[35]: class Obj1():
- ...: def __eq__(self, other):
- ...: raise TypeError
- ...: def __hash__(self):
- ...: return 1
- ...:
- In[36]: class Obj2():
- ...: def __eq__(self, other):
- ...: raise TypeError
- ...: def __hash__(self):
- ...: return 2
- ...:
- In[37]: {Obj1():1, Obj2(): 2}
- Out[37]: {<__main__.Obj1 at 0x1b59047ba58>: 1, <__main__.Obj2 at 0x1b59047bc50>: 2}
Advertisement
Add Comment
Please, Sign In to add comment