Thanks for some great explanations and alternatives!

I'll go with the any() approach, as its nice and readable (my
noShowList is quite small compared to myList).  Thanks, John, for the
'make it obvious' tip.

As an exercise, if I now wanted to show the entries where the
'noShowList' matches, what would be the best option (using list
comprehension)

i.e. ['item one', 'item three']

My original version:
print [x for x in myList for y in noShowList if y in x]

Version based on previous answer:
print [x for x in myList if any(y in x for y in noShowList)]

Cheers!

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

Reply via email to