def elementsPresent(aList, match):
     match = set(match)
     for item in aList:
         if item in match:
             return True
     return False

This could be rewritten in Python2.5+ as

  def elementsPresent(aList, match):
    match = set(match)
    return any(elem in match for elem in aList)

though as suggested both places, the set intersection may be fastest.

-tkc



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to