Suppose all the elements of the short list are in the long list, and all elements are unique.
E.g.:
long = [1,2,3,4,5]
short = [1,3,5]
# same_sequence(long, short) = True
short = [1,4,3]
# same_sequence(long, short) = False
The one I have in mind is the following, but I'm not sure if it's the best way (corrected thank @abarnert)
def same_sequence(long, short):
i = -1
for e in short:
j = long.index(e, i + 1)
if j < i:
return False
else:
i = j
return True