Guest User

Untitled

a guest
Jul 9th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. class A(object):
  2.     def do_nothing(self):
  3.         return self
  4.  
  5.     def fail(self, t):
  6.         raise RuntimeError('fail')
  7.  
  8.  
  9. def main():
  10.     a = A()
  11.  
  12.     (a
  13.         .do_nothing()
  14.         .do_nothing()
  15.         .fail(True)
  16.         .fail(True)
  17.         .do_nothing()
  18.     )
  19.  
  20.  
  21. if __name__ == '__main__':
  22.     main()
  23.  
  24.  
  25. # $ python3.7 script.py
  26. # Traceback (most recent call last):
  27. #   File "script.py", line 22, in <module>
  28. #     main()
  29. #   File "script.py", line 15, in main
  30. #     .fail(True)
  31. #   File "script.py", line 6, in fail
  32. #     raise RuntimeError('fail')
  33. # RuntimeError: fail
  34.  
  35. # $ python3.9 script.py
  36. # Traceback (most recent call last):
  37. #   File "/home/komendart/temp/script.py", line 22, in <module>
  38. #     main()
  39. #   File "/home/komendart/temp/script.py", line 12, in main
  40. #     (a
  41. #   File "/home/komendart/temp/script.py", line 6, in fail
  42. #     raise RuntimeError('fail')
  43. # RuntimeError: fail
Advertisement
Add Comment
Please, Sign In to add comment