Le 25/02/2018 à 14:11, Nikolaus Rath a écrit :
> On Feb 25 2018, Chris Angelico <ros...@gmail.com> wrote:
>> On Sun, Feb 25, 2018 at 11:02 PM, Nikolaus Rath <nikol...@rath.org> wrote:
>>> On Feb 22 2018, Serhiy Storchaka <storch...@gmail.com> wrote:
>>>> 1. Inner generator expression:
>>>>
>>>>     result = [y + g(y) for y in (f(x) for x in range(10))]
>>>>
>>> [...]
>>>>


>>>> And maybe there are other ways.
>>>
>>> I think the syntax recently brough up by Nick is still the most
>>> beautiful:
>>>
>>>     result = [ (f(x) as y) + g(y) for x in range(10)]

Honestly I find this version the most readable while the double for loop
is completely weird to me, despite doing python for a living for years.

I really hope the later doesn't become a common idiom.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to