On 11/11/2014 5:52 PM, Ben Finney wrote:
Terry Reedy <tjre...@udel.edu> writes:

We love 'assert' so much that we have 20-30 'assertXYZ' variations in
unittest.

A function will not be disabled by a run-time option to the Python
interpreter.

The statement 'assert expression' is almost equivalent to

if not expression: raise AssertionError('expression')

With the important difference that this will be active no matter what
options Python's interpreter is run with. That makes it quite a
different proposition from using ‘assert’ statements.

Which importand difference I pointed out (and you snipped) as a reason to seldom use bare assert.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to