Agreed.


On Oct 2, 2013, at 10:46 AM, Matthew Rocklin <notifications@github.com> wrote:

> In toolz/itertoolz/recipes.py:
> 
> > +    both Python 2 and 3 compatible (Python 3 works without the
> > +    application of `list`).
> > +
> > +    >>> is_space = lambda c: c == " "
> > +    >>> list(partitionby(is_space, "I have spaces"))
> > +    [['I'], [' '], ['h', 'a', 'v', 'e'], [' '], ['s', 'p', 'a', 'c', 'e', 's']]
> > +
> > +    >>> is_large = lambda x: x > 10
> > +    >>> list(partitionby(is_large, [1, 2, 1, 99, 88, 33, 99, -1, 5]))
> > +    [[1, 2, 1], [99, 88, 33, 99], [-1, 5]]
> > +
> > +    See also:
> > +        partition
> > +        groupby
> > +    """
> > +    return map(compose(list, second), itertools.groupby(s, key=f))
> The unfortunate side-effect of using list is that this is no longer fully lazy. Sounds like this is a reasonable trade-off though.
> 
> —
> Reply to this email directly or view it on GitHub.
>