On Jul 17, 2016 3:23 PM, "Serhiy Storchaka" firstname.lastname@example.org 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:
- A view that represents a sliced subsequence. Lazy equivalent of seq[start:end:step]. This feature is implemented in third-party module dataview .
On Sun, Jul 17, 2016 at 3:21 PM, Wes Turner email@example.com wrote:
SortedContainers implements exactly that as a method on SortedList as:
SortedList.islice(start=None, stop=None, reverse=False) Returns an iterator that slices self from start to stop index, inclusive and exclusive respectively. When reverse is True, values are yielded from the iterator in reverse order. Both start and stop default to None which is automatically inclusive of the beginning and end. Return type: iterator
I chose to limit the stride to 1 or -1 using the keyword parameter "reverse." No complaints though it differs from traditional slice syntax.