On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote: >> On Tue, 30 Aug 2005 12:18:59 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote: >> >>>Talin <[EMAIL PROTECTED]> writes: >>> >>>> I'm finding that a lot of places within my code, I want to return the >>>> output of a generator from another generator. Currently the only >>>> method I know of to do this is to explicitly loop over the results >>>> from the inner generator, and yield each one: >>>> >>>> for x in inner(): >>>> yield x >>>> >>>> I was wondering if there was a more efficient and concise way to do >>>> this. And if there isn't, >>> >>>Greenlets, perhaps? (for which, see google). >>> >> Maybe >> >> yield in inner() >> >> could be sugar for the above and become something optimized? > >The problem here is that yield isn't a statement any more. It's now an >expression, so it is not easy to find new syntax around it. > No, the idea was that it's still a statement, but what it yields is "in inner()" which UIAM is illegal now, and would signify "whatever sequence of elements is in inner()" -- really yield in seq -- I don't know what inner() was, but I assumed an iterable. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list