Hi,

No, this won't do. What is needed is a way to yield the results of a generator 
from inside another generator with having to do a for-yield-loop inside the 
outter generator.

Regards,

Francis Girard

Le mardi 1 Mars 2005 22:35, Adam Przybyla a ÃcritÂ:
> ÂÂÂÂÂÂÂÂ... mayby that way:
> ython 2.2.3 (#1, Oct 15 2003, 23:33:35)
> [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from __future__ import generators
> >>> def x():
>
> ... Âfor i in range(10): yield i
> ...
>
> >>> x()
>
> <generator object at 0x82414e0>
>
> >>> for k in x(): print k,
>
> ...
> 0 1 2 3 4 5 6 7 8 9
>
> >>> for k in x(): print k,
>
> ...
> 0 1 2 3 4 5 6 7 8 9
>
> >>> for k in x(): print k,
>
> ...
> 0 1 2 3 4 5 6 7 8 9
>
> >>> yield_all=[k for k in x()]
> >>> yield_all
>
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

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

Reply via email to