Re: [Python-Dev] Proposal: new list function: pack

2009-03-20 Thread Nick Coghlan
Hrvoje Niksic wrote: > Looking at izip(*[iter(l)]*n), I tend to agree. Note that the itertools recipes page in the docs includes the following: def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(iterable) next(b, None) return izip(a, b) There are a couple o

Re: [Python-Dev] Proposal: new list function: pack

2009-03-20 Thread Hrvoje Niksic
Isaac Morland wrote: I propose this because i need a lot of times pack and slide function over list and this one combine the two in a generator way. I've written functions with a subset of this functionality on more than one occasion. Having it in itertools looks like it would be useful to a

Re: [Python-Dev] Proposal: new list function: pack

2009-03-20 Thread Isaac Morland
On Fri, 20 Mar 2009, paul bedaride wrote: I propose a new function for list for pack values of a list and sliding over them: then we can do things like this: for i, j, k in pack(range(10), 3, partialend=False): print i, j, k I propose this because i need a lot of times pack and slide functi

Re: [Python-Dev] Proposal: new list function: pack

2009-03-20 Thread Aahz
On Fri, Mar 20, 2009, paul bedaride wrote: > > I propose a new function for list for pack values of a list and > sliding over them: Please switch this discussion to python-ideas -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a