Advertisement
sword_smith

Python communism

Jan 16th, 2022
1,263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import communism
  2.  
  3.  
  4. class MyClass1:
  5.     pass
  6.  
  7.  
  8. class MyClass2:
  9.     pass
  10.  
  11. print(MyClass1() == MyClass2())
  12. communism.revolution(globals())
  13. print(MyClass1() == MyClass2())
  14.  
  15. # As all classes are equal (in __hash__ and in __eq__)
  16. # This is why you cannot put more than one object in any Set or Dict
  17. print(set([MyClass1(), MyClass2(), MyClass2()]))
  18.  
  19. ## outputs
  20. # False
  21. # True
  22. # {<__main__.MyClass1 object at 0x7fc6c66b0fa0>}
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement