Best practice for handling exceptions inside asynchronous list comprehensions?
Discussions on Python.org
Best practice for handling exceptions inside asynchronous list comprehensions?
I am trying to use asynchronous list comprehensions to collect data from an async generator. However, some tasks can occasionally raise an exception (like a network timeout). When an exception occurs, it breaks the entire comprehension. Is there an elegant way to handle or ignore exceptions inside the async list comprehension itself, or do I have to fall back to a traditional async for loop with a try/except block? Here is a simplified version of what I am trying to achieve: import asyncio im...
0 comments
No comments yet.