can generators be nested?

Seo Sanghyeon tinuviel at sparcs.kaist.ac.kr
Thu Aug 28 00:45:46 EDT 2003


news.west.cox.net <mark at hahnca.com> wrote:
> This doesn't work, but is there any elegant way to do something like this?
(Someone wants to simplify "for value in generator: yield value".)

Currently there is no way around this.

There were some dicsussions on this topic, and some syntaxes were
proposed, and some said for-yield solution is just fine.

* for i in g: yield i
* yield every g
* yield << g
* etc.

You may search the archive for details. (ex. "yield every".)
I hope this one does not become yet another if-then-else expression. :(

Seo Sanghyeon




More information about the Python-list mailing list