>   Sure, that would work.  Or even this, if the scheduler would
> automatically recognize generator objects being yielded and so would run
> the the nested coroutine until finish:

This idea has been discussed before.  I think the problem with recognizing
generators as the subject of "yield" statements is that then you can't yield
a generator even if you want to.

The best syntax I can think of without adding a new keyword looks like this:

        yield from x

which would be equivalent to

        for i in x:
            yield i

Note that this equivalence would imply that x can be any iterable, not just
a generator.  For example:

        yield from ['Hello', 'world']

would be equivalent to

        yield 'Hello'
        yield 'world'



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to