Terry J. Reedy <tjre...@udel.edu> added the comment: (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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue23316> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com