I was just perusing the Built-in Functions of Python 3.2 (< http://docs.python.org/py3k/library/functions.html>) and was wondering where would one ever use any() or all().
all(iterable) Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to: def all(iterable): for element in iterable: if not element: return False return True any(iterable) Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: def any(iterable): for element in iterable: if element: return True return False Given a = [0, 1, 2, 3], >>> all(a) False >>> any(a) True But so what? Could I get some better examples? And why >>> all([]) True >>> any([]) False Thanks, Dick Moores
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor