Sol Toure wrote:
def are_elements_present(sourceList, searchList):    for e in searchList:
          if e not in sourceList:
               return False
    return True


Using set:
  def are_elements_present(sourceList, searchList):
         return len(set(sourceList).intersection(set(searchList)) ==
len(searchList)


Unless I'm missing something, (and I didn't bother to
read the original code so I may be) that's a subset test:

set (searchList) <= set (searchList)

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

Reply via email to