view hglib/util.py @ 2:5fa34c3ac9a0

turn hglib into a module and expose open (previously connect) in its __init__.py so common usage will now be: import hglib hglib.open(...) also rename hglib.py to client.py
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Jul 2011 22:55:36 +0300
parents 79f88b4db15f
children d7903b923217
line wrap: on
line source

import itertools

def grouper(n, iterable):
    ''' list(grouper(2, range(4))) -> [(0, 1), (2, 3)] '''
    args = [iter(iterable)] * n
    return itertools.izip(*args)