I have a list of elements in python and a way to check if an element is valid. I need to reject the entire list if any of the elements there are invalid. I could do this:
def valid(myList): for x in myList: if isInvalid(x): return False return True
Is there a more pythonic way to do this? You can filter it, but it will evaluate all the items in the list if only the first rating can be sufficient (if it's bad) ...
Many thanks for your help.
source share