On 15 Mar, 21:35, mpc <[EMAIL PROTECTED]> wrote:

> generator embedded in the argument only once. Can anyone explain while
> the generator will not re-initiate, and suggest a simple fix?


I am not sure what you are trying to do, but it seems a bit confused.


>>> def concat(seq):
        for s in seq: yield s

>>> seq = xrange(3)

>>> for n in xrange(5):
        h = concat(s for s in seq)
        for i in h: print i,n


0 0
1 0
2 0
0 1
1 1
2 1
0 2
1 2
2 2
0 3
1 3
2 3
0 4
1 4
2 4

Generators work they way they should. Even when one is used as
argument for another.








-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to