fork download
  1. class X:
  2. def __bool__(self):
  3. return False
  4.  
  5. x = X()
  6.  
  7. print(not x)
  8. print(x == None)
  9.  
  10. class Y:
  11. def __eq__(self, other):
  12. return True
  13.  
  14. y = Y()
  15.  
  16. print(not y)
  17. print(y == None)
Success #stdin #stdout 0.06s 9568KB
stdin
Standard input is empty
stdout
True
False
False
True