On Fri, Dec 1, 2017 at 10:31 AM, Steven D'Aprano <st...@pearwood.info>
wrote:

> On Thu, Nov 30, 2017 at 11:54:39PM -0500, Random832 wrote:
>
> > The OP isn't confusing anything; it's Eric who is confused. The quoted
> > paragraph of the PEP clearly and unambiguously claims that the sequence
> > is "arguments -> function -> call", meaning that something happens after
> > the "function" stage [i.e. a None check] cannot short-circuit the
> > "arguments" stage. But in fact the sequence is "function -> arguments ->
> > call".
>
> I'm more confused than ever. You seem to be arguing that Python
> functions CAN short-circuit their arguments and avoid evaluating them.
> Is that the case?
>
> If not, then I fail to see the difference between
>
> "arguments -> function -> call"
>
> "function -> arguments -> call"
>
> In *both cases* the arguments are fully evaluated before the function is
> called, and so there is nothing the function can do to delay evaluating
> its arguments.
>
> If this is merely about when the name "function" is looked up, then I
> don't see why that's relevant to the PEP.
>
> What am I missing?
>
> ​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​

​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.
​
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to