Re: yield all entries of an iterable

2010-10-24 Thread Cameron Simpson
On 25Oct2010 01:37, Stefan Schwarzer wrote: | From the question and the code snippet the OP gave I assumed | he meant that there already was a sequence (i. e. linear | structure) to begin with. I suspected that was your interpretation. | By the way, I think a well-known example of what you | des

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Cameron, On 2010-10-25 01:08, Cameron Simpson wrote: > On 24Oct2010 20:58, Stefan Schwarzer wrote: > | On 2010-10-21 00:27, Sebastian wrote: > | > Is there a simpler way to yield all elements of a sequence than this? > | > for x in xs: > | > yield x > | > | Can you give an example where y

Re: yield all entries of an iterable

2010-10-24 Thread Cameron Simpson
On 24Oct2010 20:58, Stefan Schwarzer wrote: | On 2010-10-21 00:27, Sebastian wrote: | > Is there a simpler way to yield all elements of a sequence than this? | > for x in xs: | > yield x | | Can you give an example where you would need this? Can't | you just iterate over the sequence? The us

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Sebastian, On 2010-10-21 00:27, Sebastian wrote: > Is there a simpler way to yield all elements of a sequence than this? > for x in xs: > yield x Can you give an example where you would need this? Can't you just iterate over the sequence? If you really need an iterator, you can use `iter(s

Re: yield all entries of an iterable

2010-10-23 Thread Chris Rebert
On Wed, Oct 20, 2010 at 3:27 PM, Sebastian 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