pytoolz/toolz — pull request #36 by eigenhombre (2013-10-02 15:32:20+00:00)
Title: Add partition by

Aside from adding `partitionby` and tests, this also changes `__init__.py`'s to pick `identity` from `functoolz` rather than `itertoolz`. (`identity` is clearly functional at base, IMO).

This was tricky to get right, as per the docstring for `partitionby`. `itertools.groupby` gets you part of the way there but needs the extra `map(compose(list, second), ..)` to work (if you just `map(second...)` it works in Python 3 but not 2.x). I actually don't fully understand how `groupby` differs between Py2 and 3, but the current implementation seems to work well.