On Mon, Mar 5, 2018 at 2:49 PM, Mike Miller <python-id...@mgmiller.net> wrote:
> Yes, thanks:
>
>     [ f(y), g(y) for x, h(x) as y in things ]
>
>
> Dyslexics untie!

:)

Hmm. The trouble here is that a 'for' loop is basically doing
assignment. When you say "for x, h(x) as y in things", what Python
does is (simplified):

_it = iter(things)
while not StopIteration:
    x, (h(x) as y) = next(_it)
    ... loop body ...

So what you're asking for is something that doesn't behave like an
assignment target, but just does its own assignment. Bear in mind,
too, that "x = next(_it)" is very different from "x, = next(_it)";
which one is "x, (h(x) as y) = next(_it)" more like?

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to