Do All() And Any() Always Short-circuit In Order?
As per https://stackoverflow.com/a/17246413/2687324, all() and any() short-circuits. Is the order of evaluation guaranteed? Using the example from the linked answer: >>> d
Solution 1:
According to the python documentation :
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: returnFalsereturnTrue
So as said in the comments the answer is yes, if the order of your iterable is stable.
Post a Comment for "Do All() And Any() Always Short-circuit In Order?"