This might be a silly question, but is it possible to check whether the elements in a tuple1 are a subset of another tuple2 in the same sequence as they appear in tuple1? I tried to do this with .issubset, but this does not look at whether the sequence of tuple1 is in tuple 2:
tuple1 = ([1, 2, 3])
tuple2 = ([1, 2, 3, 4, 5])
set(tuple1).issubset(tuple2)
True
tuple1 = ([1, 2, 3])
tuple2 = ([1, 3, 2, 4, 5])
set(tuple1).issubset(tuple2)
True # Only membership is considered, not sequence
What I would like is:
tuple1 = ([1, 2, 3])
tuple2 = ([1, 2, 3, 4, 5])
(tuple1).sequenceisin(tuple2)
True
tuple1 = ([1, 2, 3])
tuple2 = ([1, 3, 2, 4, 5])
(tuple1).sequenceisin(tuple2)
False
Is there a simple way to do this?