Message45190
Logged In: YES
user_id=6380
Sorry, I meant the first, not the last. I was confused about
how the 'for' clauses are nested, but the outermost one is
the first.
So the nesting remark is probably just confusing and wrong;
ignore it.
What I meant is:
(f(x,y) for x in A() for y in B(x))
should IMO precompute A(), but not B(x). I guess the
equivalent generator function would be:
def __gen(__outer__=A(), f=f, B=B):
for x in __outer__:
for y in B(x):
yield f(x,y)
In general the value of every free variable used anywhere
except in the outer expression should be captured; the
*value* of the outer expression should be captured. This
should give the least surprising semantics in a variaty of use
cases.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:31:38 | admin | link | issue872326 messages |
2007-08-23 15:31:38 | admin | create | |
|