dataset = ['this', 'is', 'words', 'or', 'something'] def grep(word, dataset): """Returns true if word is in the dataset""" def f(data): return data == word return reduce(lambda x, y:x+y, map(f, dataset)) > 0 print grep('this', dataset) print grep('not', dataset)