If I have a regular iterable object in Python I can use any and a generator comprehension to get boolean. E.g.
from pathlib import Path
path = Pathlib("/foo/bar/baz")
has_contents = any(path.iterdir())
And I can do the same thing with an async_generator and list comprehension:
is_empty = any([x async for x in async_generator])
But it doesn't seem to be possible to do the same with an async_generatorand a generator comprehension.
not_empty = any(x async for x in foo.iter())
raises
TypeError: 'async_generator' object is not iterable
Is there a way to use an async_generator inside a generator comprehension?