[Python-ideas] return value of yield expressions
H. Krishnan
hetchkay at gmail.com
Tue Sep 13 19:21:22 CEST 2011
>
> > (a1, a2, a3 = 3, *args, **kwds) = (yield <expr>)
>
> What on earth is this syntax supposed to mean? Never mind that there's
> a yield on the RHS; it is just a parenthesized expression so it could
> could be any other function. What on earth do you expect to happen
> with the syntax on the left, i.e. with the part
>
>
> (a1, a2, a3 = 3, *args, **kwds) = ........whatever........
>
> As I said "forgeting the backward compatibility issue". Suppose we use
Jacob's syntax (for argument's sake)
*(a1, a2, a3 = 3, *args, **kwds) = (yield expr)
and with g.send(*a, **k) being called, a1, a2, a3, args, kwds can be
inferred using the same semantics that is used to decipher a1, a2, a3, args,
kwds in a call to the following function with *a and **k as arguments:
def func(a1, a2, a3 = 3, *args, **kwds):
...
That (yield expr) can be used in expressions does not (I feel) affect this
(particularly if we go with Jacob's suggestion of this being a general
unpacking option), just in the same way that "a, b, *args, c = <tuple>" does
not affect using tuples in expressions. But after reading your comment in
another thread about those who don't know how python works should keep
quiet, I guess it is best if I end this here :-)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110913/58349d3f/attachment.html>
More information about the Python-ideas
mailing list