iBrett,
iter
On Fri, Sep 16, 2011 at 3:35 AM, Brett Ritter wrote:
> I ran into this article (
> http://blog.adku.com/2011/09/hodgepodge-of-python.html ) and found
> myself temporarily stymied by one line it in:
>
> zip(*[iter(a)]*2)
>
> Used like this:
>
> >>> a = ['a','1','b','2','c','3']
> >>
;3']; [(a[i], a[i+1]) for i
>>> in range(0, len(a), 2)]")
>>> t.timeit()
2.5330216549868823
>>>
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system
I ran into this article (
http://blog.adku.com/2011/09/hodgepodge-of-python.html ) and found
myself temporarily stymied by one line it in:
zip(*[iter(a)]*2)
Used like this:
>>> a = ['a','1','b','2','c','3']
>>> zip(*[iter(a)]*2)
[('a', '1'), ('b', '2'), ('c', '3')]
While I'm unlikely to use suc