Guest User

Untitled

a guest
Aug 20th, 2017
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. In[35]: class Obj1():
  2.    ...:     def __eq__(self, other):
  3.    ...:         raise TypeError
  4.    ...:     def __hash__(self):
  5.    ...:         return 1
  6.    ...:    
  7. In[36]: class Obj2():
  8.    ...:     def __eq__(self, other):
  9.    ...:         raise TypeError
  10.    ...:     def __hash__(self):
  11.    ...:         return 2
  12.    ...:    
  13. In[37]: {Obj1():1, Obj2(): 2}
  14. Out[37]: {<__main__.Obj1 at 0x1b59047ba58>: 1, <__main__.Obj2 at 0x1b59047bc50>: 2}
Advertisement
Add Comment
Please, Sign In to add comment