<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#330033" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 10/4/2017 5:22 PM, Yarko Tymciurak
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAJ+Z=PJK7hYVddaertLAApZQVPcoXo4vpawODxORxUAgibUk+Q@mail.gmail.com">
<div dir="ltr">Barry suggested I bring this up here.
<div><br>
</div>
<div>It seems the right time to at least discuss this:</div>
<div><br>
</div>
<div>RE: PEP 553 enabling / disabling breakpoints ---</div>
<div><br>
</div>
<div>I've recently started using a simple conditional breakpoint
in ipython, and wonder if - in addition to Nick Coghlan's
request for the env 'PYTHONBREAKPOINT' (boolean?), it would
make sense (I _think_ so) to add a condition parameter to the
breakpoint() call. This does raise several questions, but it
seems that it could make for a simple unified way to
conditionally call an arbitrary debugger. What I found useful
(in the contecxt of ipython - but general enough) you can see
in this gist: <a
href="https://gist.github.com/yarko/bdaa9d3178a6db03e160fdbabb3a9885"
moz-do-not-send="true">https://gist.github.com/yarko/bdaa9d3178a6db03e160fdbabb3a9885</a></div>
<div><br>
</div>
<div>If PEP 553's breakpoint() were to follow this sort of
interface (with "condition"), it raises a couple of questions:</div>
<div>- how would a missing (default) parameter be done?</div>
<div>- how would parameters to be passed to the debugger "of
record" be passed in (named tuple? - sort of ugly)</div>
<div>- would PYTHONBREAKPOINT be a global switch (I think yes),
vs a `condition` default.</div>
<div><br>
</div>
<div>I have no dog in the fight, but to raise the possibility
(?) of having PEP 553 implement simple conditional breakpoint
processing.</div>
<div><br>
</div>
<div>Any / all comments much appreciated.</div>
<br>
</div>
</blockquote>
breakpoint() already accepts arguments. Therefore no change to the
PEP is needed to implement your suggestion. What you are suggesting
is simply a convention among debuggers to handle a parameter named
"condition" in a particular manner.<br>
<br>
It seems to me that<br>
<br>
if condition:<br>
breakpoint()<br>
<br>
would be faster and clearer, but there is nothing to prevent a
debugger from implementing your suggestion if it seems useful to the
developers of the debugger. If it is useful enough to enough people,
the users will clamor for other debuggers to implement it also.<br>
</body>
</html>