FutureDreams

Line 10 -> 2B || !2B

Nov 28th, 2021 (edited)
475
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class InspectorDuck:
  2.     c = 0
  3.  
  4.     def __init__(self, val):
  5.         self.val = val
  6.  
  7.     def __eq__(self, other):
  8.         self.c += 1
  9.         print(f"Calling __eq__ on {self}, it is {self.c} time we are doing this")
  10.         return True  # change this to "return False" to stop the world from burning
  11.  
  12.     def __str__(self):
  13.         return str(self.val)
  14.  
  15.  
  16. a = [InspectorDuck(5)]
  17. b = [InspectorDuck(4)]
  18. a.append(b)
  19. b.append(a)
  20.  
  21. print(a == b)
  22.  
RAW Paste Data