[Python-ideas] A real life example of "given"

Peter O'Connor peter.ed.oconnor at gmail.com
Wed May 30 14:09:32 EDT 2018

On Wed, May 30, 2018 at 7:59 PM, Neil Girdhar <mistersheik at gmail.com> wrote:
> z = {a: transformed_b
>      for b in bs
>      given transformed_b = transform(b)
>      for a in as_}
> There is no nice, equivalent := version as far as I can tell.

Well you could just do:

    z = {a: b
         for b in (transform(bi) for bi in bs)
         for a in as_}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180530/0ba098e9/attachment.html>

More information about the Python-ideas mailing list