yield all entries of an iterable
Chris Rebert
clp2 at rebertia.com
Sat Oct 23 18:22:39 EDT 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
http://www.python.org/dev/peps/pep-0380/
It would let you write:
yield from xs
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list