<div dir="ltr"><div class="gmail_default" style="font-size:small">On Wed, Apr 25, 2018 at 4:56 AM, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Tim]<br>
<span class="">>> Binding expressions are debugger-friendly in that they _don't_ just<br>
>> vanish without a trace. It's their purpose to _capture_ the values of<br>
>> the expressions they name. Indeed, you may want to add them all over<br>
>> the place inside expressions, never intending to use the names, just<br>
>> so that you can see otherwise-ephemeral intra-expression results in<br>
>> your debugger ;-)<br>
<br>
<br>
</span>[Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>>]<br>
<span class=""> wrote:<br>
> That's a fantastic point and I'm surprised nobody has thought of it<br>
> until now (that I've seen).<br>
><br>
> Chris, if you're still reading this and aren't yet heartedly sick and<br>
> tired of the PEP *wink* this ought to go in as another motivating point.<br>
<br>
</span>You know, I thought I was joking when I wrote that - but after I sent<br>
it I realized I wasn't ;-)<br>
<br></blockquote><div><div class="gmail_default" style="font-size:small;display:inline">You just don't realise how perspicacious you truly are, Tim!</div></div><div><div class="gmail_default" style="font-size:small;display:inline"></div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It would actually be quite convenient, and far less error-prone, to<br>
add a binding construct inside a complicated expression for purposes<br>
of running under a debugger. The alternative is typing the<br>
sub-expression(s) of interest by hand at the debugger prompt, or<br>
adding print()s, both of which are prone to introducing typos, or<br>
changing results radically due to triggering side effects in the code<br>
invoked by the duplicated sub-expression(s). Adding a binding<br>
construct wouldn't change anything about how the code worked (apart<br>
from possibly clobbering a local name).</blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Indeed, in the cases where I currently find myself unwrapping expressions to capture their values in local variables for debugging purposes it would usually be far less intrusive to bind a name to the expression inline, then use the debugger to inspect the value.</div><div class="gmail_default" style="font-size:small"></div><br></div></div></div></div>