Le 25/02/2018 à 14:11, Nikolaus Rath a écrit : > On Feb 25 2018, Chris Angelico <rosuav at gmail.com> wrote: >> On Sun, Feb 25, 2018 at 11:02 PM, Nikolaus Rath <Nikolaus at rath.org> wrote: >>> On Feb 22 2018, Serhiy Storchaka <storchaka at 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4