[Python-ideas] Sequence views

Wes Turner wes.turner at gmail.com
Sun Jul 17 18:21:24 EDT 2016

There are a number of generic implementations of these sequence algorithms:

* http://toolz.readthedocs.io/en/latest/api.html#itertoolz
* https://github.com/kachayev/fn.py#itertools-recipes
* http://funcy.readthedocs.io/en/stable/seqs.html
  * http://docs.python.org/2/reference/expressions.html#slicings
  * https://docs.python.org/2/library/itertools.html#itertools.islice
  * https://docs.python.org/3/library/itertools.html#itertools.islice

On Jul 17, 2016 3:23 PM, "Serhiy Storchaka" <storchaka at gmail.com> wrote:
> Maybe it's time to add a new module for sequence-specific functions
(seqtools?). It should contain at least two classes or fabric functions:
> 1. A view that represents a sliced subsequence. Lazy equivalent of
seq[start:end:step]. This feature is implemented in third-party module
dataview [1].


> 2. A view that represents a linear sequence as 2D array. Iterating this
view emits non-intersecting chunks of the sequence. For example it can be
used for representing the bytes object as a sequence of 1-byte bytes
objects (as in 2.x), a generalized alternative to iterbytes() from PEP 467



> Neither itertools nor collections modules look good place for these
features, since they are not concrete classes and work only with sequences,
not general iterables or iterators. On other side, mappingproxy and
ChainMap look close, maybe new module should be oriented not on sequences,
but on views.
> [1] https://pypi.python.org/pypi/dataview
> [2] https://www.python.org/dev/peps/pep-0467


> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160717/d7d09a4a/attachment.html>

More information about the Python-ideas mailing list