<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">I didn't mean to replace the current (debug) assert but I wanted to add another one that would allow to be switch on or off on production builds.</p>
<p style="margin-top:0;margin-bottom:0">The need for a new keyword (not syntax) comes from this difference.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"> I cannot think of another example that would convince you of the benefit of having a specific keyword for such a runtime assert. <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"> I
 do believe that having such a feature in non-debug build is more than interesting but indeed needed.</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><br>
</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">At some point, there should be a trade-off between to relying on a simple keyword/mechanism (for a runtime assert) versus the development cost of adding such a feature and maintaining it.
 Anyway, thanks for your feedback Serhiy, it helps.</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Python-ideas <python-ideas-bounces+eloi.gaudry=fft.be@python.org> on behalf of Serhiy Storchaka <storchaka@gmail.com><br>
<b>Sent:</b> Saturday, May 5, 2018 17:44<br>
<b>To:</b> python-ideas@python.org<br>
<b>Subject:</b> Re: [Python-ideas] Runtime assertion with no overhead when not active</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">05.05.18 18:04, Eloi Gaudry пише:<br>
> By 'self-contained', I meant that using the assert keyword and its <br>
> expression is sufficient. An inline assertive expression as the one you <br>
> describe does not fulfill this assert requirement.<br>
<br>
Sufficient for what? And why writing with using the existing syntax is <br>
not sufficient?<br>
<br>
> My proposal is simply to extend the current assert to non-debug builds <br>
> and allow to switch it off/on at runtime.<br>
<br>
The main property of the assert statement is that has a zero overhead in <br>
non-debug run. If you remove this property, it will be not the assert <br>
statement, and you will not need a special syntax support for writing <br>
this runtime check.<br>
<br>
> The syntax example I gave illustrated what I meant by syntax aware.<br>
<br>
It doesn't illustrate why a new syntax is necessary. Or I can't <br>
understand this illustration.<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
Python-ideas@python.org<br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" id="LPlnk922448" class="OWAAutoLink" previewremoved="true">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" id="LPlnk958745" class="OWAAutoLink" previewremoved="true">
http://python.org/psf/codeofconduct/</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>