An inefficient yet basic and mostly sufficient implementation of a Python function asserting that elements of one iterator are a sublist another's.
def issublist(a, b):
sep = '\xC0\xFF\xEE'
a_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in a]), sep)
b_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in b]), sep)
return a_str in b_str
0 comments:
Post a Comment