<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 7, 2018 at 6:24 AM, Serhiy Storchaka <span dir="ltr"><<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>></span> wrote:<span class=""></span><br><span class=""></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I just don't understand why you need a new keyword for writing runtime checks.<br></blockquote></div><br></div><div class="gmail_extra">Oh, that's pretty clear. The OP wants to be able to turn these checks off with some flag he can set/clear at runtime, and when it's off he doesn't want to incur the overhead of evaluating the check. The assert statement has the latter property, but you have to use -O to turn it off. He basically wants a macro so that<br><br></div><div class="gmail_extra">  runtime_assert(<expr>)<br><br></div><div class="gmail_extra">expands to<br><br></div><div class="gmail_extra">  if <controlling flag> and (<expr>):<br>      raise AssertionError<br clear="all"></div><div class="gmail_extra"><br></div><div class="gmail_extra">In Lisp this would be easy. :-)<br></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>