About 277,000 results
Open links in new tab
  1. How do Python's any and all functions work? - Stack Overflow

    58 How do Python's any and all functions work? any and all take iterables and return True if any and all (respectively) of the elements are True.

  2. python - Using any () and all () to check if a list contains one set of ...

    190 Generally speaking: all and any are functions that take some iterable and return True, if in the case of all, no values in the iterable are falsy; in the case of any, at least one value is truthy. A …

  3. any () function in Python with a callback - Stack Overflow

    Jan 6, 2010 · The Python standard library defines an any() function that Return True if any element of the iterable is true. If the iterable is empty, return False. It checks only if the …

  4. How does this input work with the Python 'any' function?

    But with generator expressions, Python no longer has to create that internal list of True(s) and False(s), the values will be generated as the any function iterates through the values …

  5. python - Use a.any () or a.all () - Stack Overflow

    Dec 26, 2015 · if valeur <= 0.6: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() I have read several posts about a.any () or a.all () …

  6. python - Opposite of any () function - Stack Overflow

    The Python built-in function any (iterable) can help to quickly check if any bool (element) is True in a iterable type. >>> l = [None, False, 0] >>> any (l) False >>> l = [...

  7. python - Timeout on a function call - Stack Overflow

    Jan 30, 2009 · I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds …

  8. How can I specify the function type in my type hints?

    Jun 15, 2016 · How can I specify the type hint of a variable as a function type? There is no typing.Function, and I could not find anything in the relevant PEP, PEP 483.

  9. python - any and not any function - Stack Overflow

    Mar 2, 2023 · Terminology note: any is not an operator; it's an ordinary function. Operators are tokens like +, -, etc that are implemented using methods defined on the type (s) involved.

  10. python - Reason for "all" and "any" result on empty lists - Stack …

    Jul 18, 2010 · In Python, the built-in functions all and any return True and False respectively for empty iterables. I realise that if it were the other way around, this question could still be asked.