Advertisement
Guest User

Untitled

a guest
Jul 1st, 2020
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. >>> C() and True
  2. __bool__
  3. <__main__.C at 0x7fd5502c89d0> # These addresses change with repeated execution.
  4.  
  5. -------------------
  6.  
  7. >>> c = C()
  8. >>> c and True
  9. __bool__
  10. <__main__.C at 0x7fd5502c89d0>
  11. >>> c and True
  12. __bool__
  13. True
  14. >>> # That cycles on and on...
  15.  
  16. -------------------
  17.  
  18. >>> q = C() and True
  19. >>> if q:
  20. ... print('if stmt')
  21.  
  22. __bool__
  23. __bool__
  24. if stmt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement