<div dir="ltr"><div class="gmail_default" style="font-size:small">On Fri, Dec 1, 2017 at 10:31 AM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</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"><span class="">On Thu, Nov 30, 2017 at 11:54:39PM -0500, Random832 wrote:<br>
<br>
> The OP isn't confusing anything; it's Eric who is confused. The quoted<br>
> paragraph of the PEP clearly and unambiguously claims that the sequence<br>
> is "arguments -> function -> call", meaning that something happens after<br>
> the "function" stage [i.e. a None check] cannot short-circuit the<br>
> "arguments" stage. But in fact the sequence is "function -> arguments -><br>
> call".<br>
<br>
</span>I'm more confused than ever. You seem to be arguing that Python<br>
functions CAN short-circuit their arguments and avoid evaluating them.<br>
Is that the case?<br>
<br>
If not, then I fail to see the difference between<br>
<span class=""><br>
"arguments -> function -> call"<br>
<br>
</span><span class="">"function -> arguments -> call"<br>
<br>
</span>In *both cases* the arguments are fully evaluated before the function is<br>
called, and so there is nothing the function can do to delay evaluating<br>
its arguments.<br>
<br>
If this is merely about when the name "function" is looked up, then I<br>
don't see why that's relevant to the PEP.<br>
<br>
What am I missing?<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><div class="gmail_default" style="font-size:small;display:inline">​I guess it's possible that if computing the function (i.e., evaluating the expression immediately to the left of the argument list) and/or the argument has side effects​</div> <div class="gmail_default" style="font-size:small;display:inline">​then the evaluation order will affect the outcome. Intuitively it seems more straightforward to compute the function first. If this expression were to raise an exception, of course, then the arguments would not then be evaluated. Or vice versa. It would be best of the specification matches current CPython bahviour.</div></div><div><div class="gmail_default" style="font-size:small;display:inline">​</div></div></div></div></div>