cascading python executions only if return code is 0

Peter Otten __peter__ at
Mon Dec 23 18:45:29 CET 2013

Ethan Furman wrote:

>> Sigh.  Sometimes I'm not sure which is worse.  The anti-assertion
>> zealotry on this list, or the anti-regex zealotry.
> I am not a zealot (I'm not!  Really!! ;) .  I just find it alarming to
> have major pieces of software rely on a feature that can be so easily
> tuned out, and it wasn't clear from your comment that it was /any/
> exception.
> Mostly I don't want newbies thinking "Hey!  I can use assertions for all
> my confidence testing!"
> Just as one data point OpenERP, which has a lot of good features,
> unfortunately uses assert to test user input.  :(

Put the following at the beginning of every affected module:

    assert 0
except AssertionError:
    raise AssertionError("won't run with assertions turned off")


More information about the Python-list mailing list