0

Why would one use assert False, 'error' vs raise AssertionError('error')?

Joshua Fox
  • 18,704
  • 23
  • 87
  • 147
s5s
  • 11,159
  • 21
  • 74
  • 121

1 Answers1

0

Just this:

  1. You can then disable the assertion, by running your Python scripts with the -O switch.
  2. Using assert gives consistency with other uses of assert, in the more common cases where the assertion is non-constant rather than just 0. (But False should really be used instead.)
Joshua Fox
  • 18,704
  • 23
  • 87
  • 147