Author terry.reedy
Recipients Guido.van.Rossum, Joshua.Landau, NeilGirdhar, SilentGhost, gvanrossum, iritkatriel, r.david.murray, serhiy.storchaka, terry.reedy
Date 2021-06-17.08:05:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
(The nosy list change was an accident of my local copy not being complete refreshed before posting.)

If (b=b, *c) were evaluated in order, then the byte code for b=b and any subsequent keyword arguments would have to be put aside, such as in a separate buffer, until it was known that there would be no following *exp.  Without lookahead, this is known when either **kw or closing ) is reached.  At that point, the keyword buffer would be copied to the main buffer.

It might actually be easier to remove all order restrictions and compile all keyword values to a side buffer, to be copied to the main buffer when the closing ) is reached. 

One version of the question I am raising is this: given that f(a, b=b) and f(*(a,), b=b) have the same effect (are alternate spellings of the same instruction(s)), why should f(b=b, a) and f(b=b, *(a,)) *not* have the same effect, with one spelling being prohibited and the other not?

The meaning of '*expression' is defined as having the same effect as an equivalent sequence of positional argument expression in the same place as the expression. 

"If the syntax *expression appears in the function call, expression must evaluate to an iterable. Elements from these iterables are treated as if they were additional positional arguments. For the call f(x1, x2, *y, x3, x4), if y evaluates to a sequence y1, …, yM, this is equivalent to a call with M+4 positional arguments x1, x2, y1, …, yM, x3, x4."

The first sentence of the next paragrapsh, allowing only *exp to follow b=exp, contradicts the last line above.  I am sorry I did not read these paregraphs carefully until now.
Date User Action Args
2021-06-17 08:05:54terry.reedysetrecipients: + terry.reedy, gvanrossum, r.david.murray, SilentGhost, Joshua.Landau, serhiy.storchaka, NeilGirdhar, Guido.van.Rossum, iritkatriel
2021-06-17 08:05:54terry.reedysetmessageid: <>
2021-06-17 08:05:54terry.reedylinkissue23316 messages
2021-06-17 08:05:54terry.reedycreate