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

Re: yield all entries of an iterable

2010-10-24 Thread Cameron Simpson
On 24Oct2010 20:58, Stefan Schwarzer sschwar...@sschwarzer.net 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

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 sschwar...@sschwarzer.net 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

Re: yield all entries of an iterable

2010-10-24 Thread Cameron Simpson
On 25Oct2010 01:37, Stefan Schwarzer sschwar...@sschwarzer.net 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

yield all entries of an iterable

2010-10-23 Thread Sebastian
Hi, Is there a simpler way to yield all elements of a sequence than this? for x in xs: yield x I tried googling but fond only the other direction (turning a generator into a list with list(my_generator()). Sebastian -- http://mail.python.org/mailman/listinfo/python-list

Re: yield all entries of an iterable

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