I have a list of strings and a list of filters (which are also strings, to be interpreted as regular expressions). I want a list of all the elements in my string list that are accepted by at least one of the filters. Ideally, I'd write
[s for s in strings if some (lambda f: re.match (f, s), filters)]
where some is defined as
def some (pred, list):
for x in list:
res = pred (x)
if res:
return res
return False
Is something like that already available in Python, or is there a more idiomatic way to do this?