On Thu, Feb 9, 2012 at 7:33 PM, Peter Otten <__pete...@web.de> wrote:
> Chris Angelico wrote:
>
>> def cycle(seq,n):
>> seq=iter(seq)
>> lst=[next(seq) for i in range(n)]
>> try:
>> while True: yield next(seq)
>> except StopIteration:
>>
08.02.12 22:15, Terry Reedy написав(ла):
To make a repeating rotator is only a slight adjustment:
k = n - len(seq)
while True:
i = k
while i < n:
yield seq[i]
i += 1
for i in range(n, len(seq)):
yield seq[i]
while True:
fo
Mark Lawrence wrote:
> I'm looking at a way of cycling around a sequence i.e. starting at some
> given location in the middle of a sequence and running to the end before
> coming back to the beginning and running to the start place. About the
> best I could come up with is the following, any bett
Chris Angelico wrote:
> On Thu, Feb 9, 2012 at 2:55 PM, Steven D'Aprano
> wrote:
>> If your data is humongous but only available lazily, buy more memory :)
>
> Or if you have a huge iterable and only need a small index into it,
> snag those first few entries into a list, then yield everything el
On Thu, Feb 9, 2012 at 2:55 PM, Steven D'Aprano
wrote:
> If your data is humongous but only available lazily, buy more memory :)
Or if you have a huge iterable and only need a small index into it,
snag those first few entries into a list, then yield everything else,
then yield the saved ones:
de
On Wed, 08 Feb 2012 01:10:28 +, Mark Lawrence wrote:
> I'm looking at a way of cycling around a sequence i.e. starting at some
> given location in the middle of a sequence and running to the end before
> coming back to the beginning and running to the start place.
If you have a sequence, and
On 08/02/2012 14:25, Neil Cerutti wrote:
On 2012-02-08, Mark Lawrence wrote:
I'm looking at a way of cycling around a sequence i.e. starting
at some given location in the middle of a sequence and running
to the end before coming back to the beginning and running to
the start place. About the b
On 2/8/2012 9:25 AM, Neil Cerutti wrote:
On 2012-02-08, Mark Lawrence wrote:
I'm looking at a way of cycling around a sequence i.e. starting
at some given location in the middle of a sequence and running
to the end before coming back to the beginning and running to
the start place. About the b
On 2012-02-08, Mark Lawrence wrote:
> I'm looking at a way of cycling around a sequence i.e. starting
> at some given location in the middle of a sequence and running
> to the end before coming back to the beginning and running to
> the start place. About the best I could come up with is the
> fo
On 08/02/2012 08:26, Mark Lawrence wrote:
On 08/02/2012 01:26, Dennis Lee Bieber wrote:
On Wed, 08 Feb 2012 01:10:28 +, Mark Lawrence
wrote:
I'm looking at a way of cycling around a sequence i.e. starting at some
given location in the middle of a sequence and running to the end before
com
On 08/02/2012 01:26, Dennis Lee Bieber wrote:
On Wed, 08 Feb 2012 01:10:28 +, Mark Lawrence
wrote:
I'm looking at a way of cycling around a sequence i.e. starting at some
given location in the middle of a sequence and running to the end before
coming back to the beginning and running to t
Mark Lawrence schrieb:
I'm looking at a way of cycling around a sequence i.e. starting at some
given location in the middle of a sequence and running to the end before
coming back to the beginning and running to the start place. About the
best I could come up with is the following, any better id
On 2/7/2012 8:10 PM, Mark Lawrence wrote:
I'm looking at a way of cycling around a sequence i.e. starting at some
given location in the middle of a sequence and running to the end before
coming back to the beginning and running to the start place. About the
best I could come up with is the follow
13 matches
Mail list logo