Given a two-dimensional list, I would like to find everything that contains a sublist. I realize I can do something like:
#Psuedo-Python (not kosher)
def MatchAll(theList,toMatch):
result=list(theList)
for nMatch in toMatch:
for nResult in result:
if not nMatch in nResult:
result.remove(nResult)
return result
But there seems to be all kinds of bad about this. It seems very unlike the Python code I've seen and dealt with so far, besides I'm making changes to the list while iterating it, which I've read is not at all a good thing. Also, it seems horribly inefficient: while toMatch shouldn't have a length greater then three for my purposes, the length of theList is unknown and could be quite large. Any help is greatly appreciated, and thanks in advance.