[Python-ideas] proposed sequence method: index_subseq()

Terry Reedy tjreedy at udel.edu
Wed Aug 28 06:47:43 CEST 2013


On 8/27/2013 11:11 PM, Steven D'Aprano wrote:
> On 28/08/13 06:21, Terry Reedy wrote:
>
>> There are subsequence algorithms that see, for instance, 1,4,7 as a
>> subsequence of 0,1,2,3,4,5,6,7,8.

An even step was an accident. It is also a subsequence of 0, 1, 40, 4, 
5, 8, 9, 5, 7.

> That's fine. They can invent their own API, but I reckon that returning
> a slice will still be the wrong thing to do. Consider (1, 3, 8) as a
> subsequence of (1, 2, 3, 4, 5, 6, 7, 8), what slice should be returned?

The indexes of each item matched.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list