Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exception_is_binary_op.py 441B

123456789101112
  1. """Warn about binary operations used as exceptions."""
  2. from __future__ import print_function
  3. try:
  4. pass
  5. except Exception or BaseException: # [binary-op-exception]
  6. print("caught1")
  7. except Exception and BaseException: # [binary-op-exception]
  8. print("caught2")
  9. except Exception or BaseException: # [binary-op-exception]
  10. print("caught3")
  11. except (Exception or BaseException) as exc: # [binary-op-exception]
  12. print("caught4")