bug with itertools.groupby?

Kitlbast vlad.shevchenko at gmail.com
Tue Oct 6 19:57:30 EDT 2009


Thanks guys!

Miss sorting when reading docs.. (

However, I just create simple "groupby":

def groupby(_list, key_func):
    res = {}
    for i in _list:
        k = key_func(i)
        if k not in res:
            res[k] = [i]
        else:
            res[k].append(i)
    return res

and it works 3 times faster then itertools.groupby for my example (for
tests I extend number of profiles)



More information about the Python-list mailing list