<div dir="ltr">The PEP says that a None-aware function call operator (e.g. "f?(x, y)") would break the rule of python that arguments are evaluated before the function but this is not correct.<div><br></div><div>In Python the function is evaluated before the arguments (but of course the CALL is made after the evaluation of the arguments).</div><div><br></div><div>A None-aware function call operator ?(...) wouldn't break this order of evaluation rule: 1) evaluate the function, 2) only if it's not None evaluate arguments and make the call.</div><div>In bytecode the None-aware function call would simply require a extra "JNONE" to the end...</div><div><br></div><div>        ...  evaluate the function ...</div><div>        JNONE  skip</div><div>        ... evaluate arguments ...</div><div>        CALL n</div><div>    skip:<br><div><br></div><div>Note that I'm not saying this would be a good thing, just that the reason the PEP uses to dismiss this option is actually wrong because Python doesn't work the way the PEP says it does.</div></div><div><br></div><div>Andrea</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 1, 2017 at 11:31 AM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><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>
<br>
--<br>
Steve<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/agriff%40tin.it" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>agriff%40tin.it</a><br>
</div></div></blockquote></div><br></div>