📅  最后修改于: 2022-03-11 14:46:32.291000             🧑  作者: Mango
def contains(list, filter):
for x in list:
if filter(x):
return True
return False
if contains(myList, lambda x: x.n == 3) # True if any element has .n==3
# do stuff