[Python-Dev] The `for y in [x]` idiom in comprehensions
Nikolaus Rath
Nikolaus at rath.org
Sun Feb 25 07:02:26 EST 2018
More information about the Python-Dev mailing list
Sun Feb 25 07:02:26 EST 2018
- Previous message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Next message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)] ..but I wonder if it is feasible to make the interpreter sufficiently smart to evaluate the first summand before the second. Best, -Nikolaus -- GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.«
- Previous message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Next message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list