any/all for Python2.4
Want to use any/all in Python2.4? Here the minimal implementation that break on the first not matching value like any and all in Python2.5 do:
def any(iterable):
return False in (not x for x in iterable)
def all(iterable):
return True not in (not x for x in iterable)
Credit for the idea goes to BlackJack from the German python forum