aioplus.aany¶
- async aioplus.aany(aiterable, /)¶
Return
Trueif any element of the async iterable evaluates toTrue.- Parameters:
aiterable (AsyncIterable of SupportsBool) – An asynchronous iterable of objects supporting
object.__bool__().- Returns:
Trueif any element evaluates toTrue.Falseif all elements evaluate toFalse, or if the iterable is empty.- Return type:
Examples
>>> import asyncio >>> >>> from aioplus import aany, arange >>> >>> async def main() -> None: >>> '''Run the program.''' >>> aiterable = (num % 2 == 0 async for num in arange(2304)) >>> flg = await aany(aiterable) >>> >>> if __name__ == '__main__': >>> asyncio.run(main())
Notes
Short-circuits on the first object that evaluates to
True.
See also