yield all entries of an iterable

Chris Rebert clp2 at rebertia.com
Sun Oct 24 00:22:39 CEST 2010

On Wed, Oct 20, 2010 at 3:27 PM, Sebastian
<sebastianspublicaddress at googlemail.com> wrote:
> Hi,
> Is there a simpler way to yield all elements of a sequence than this?
> for x in xs:
>    yield x

Not presently. There's a related PEP under discussion though:
PEP 380: Syntax for Delegating to a Subgenerator

It would let you write:
yield from xs


More information about the Python-list mailing list