What does HackerNews think of toolz?

A functional standard library for Python.

Language: Python

Maybe the toolz[0] family would cover your use cases? There is also a Cython implementation if you need better performance.

[0] https://github.com/pytoolz/toolz/

I am with you on this. Personally, I would rather continue using Toolz (https://github.com/pytoolz/toolz), and contribute additional helper/utility methods to that library.

The whole point of some things being functions versus methods is that they are generic rather than specialized. The generic iterator protocol is probably the best feature about the Python language, and it's both a damn shame and bad design to not use it.

If you really wanted to make an improvement over built in lists, the thing to do would be to implement some kind of fully lazy "query planning" engine, like what Apache Spark has. Every method call registers a new method to be applied with the query planner, but does not execute it. Execution only occurs when you explicitly request it. That way you can effectively compile in efficient but readable code that takes multiple passes over the data into efficient operations internally that only make one pass, or at least fewer passes. This also naturally lends itself to parallelization/concurrency.

Agree.

The sort of python user who regularly writes stuff like zip(seq, islice(seq, 1, None)))

may enjoy the `itertoolz` library

    https://github.com/pytoolz/toolz
which (among many other handy functions) has a sliding_window function:

    def sliding_window(n, seq):
      """ A sequence of overlapping subsequences
      >>> list(sliding_window(2, [1, 2, 3, 4]))
      [(1, 2), (2, 3), (3, 4)]
      """
      return zip(*(collections.deque(itertools.islice(it, i), 0) or it
                 for i, it in enumerate(itertools.tee(seq, n))))
I recommend PyToolz, "set of utility functions for iterators, functions, and dictionaries": https://github.com/pytoolz/toolz

The functions in PyToolz are short, well tested and idiomatic Python (thought the functional programming paradigm they support is not quite so idiomatic). I recommend starting with the excellent documentation: http://toolz.readthedocs.org/en/latest/

In particular, the API docs have links to the source code for each function: http://toolz.readthedocs.org/en/latest/api.html