<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><span id="transmark" style="display: none; width: 0px; height: 0px;"></span>"assert" is good, but it is used as a guard frequently.<br>We can make such usage legal by adding a new syntax:<br>    assert bool_expr, ExceptionType, True<br><br>suggest reasons:<br>1) even "__debug__" turn off, assert is working<br>    assertion as guard.<br><br>2) to avoid boilerplate code<br>    I write code like this:<br>        if pred(....) or pred(....):<br>            raise ValueError('pred(....) or pred(....)')<br><br>    Simplifed:<br>        assert pred(...), ValueError, True<br>        # the above line will be printed when error.<br>        # I need not to copy the condition!<br><br>3) future: "assert bool_expr, ET, False"<br>    To aid static tool, like Proof System.<br>    Better document.<br>        For complicate algorithm,<br>        I actually add a invariant outline comment<br>        above every statement.<br><br><br><br></div><br><br><span title="neteasefooter"><p> </p></span>