I love assert
tjreedy at udel.edu
Wed Nov 12 09:29:13 CET 2014
On 11/11/2014 5:52 PM, Ben Finney wrote:
> Terry Reedy <tjreedy at udel.edu> writes:
>> We love 'assert' so much that we have 20-30 'assertXYZ' variations in
> A function will not be disabled by a run-time option to the Python
>> 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
More information about the Python-list