Région de recherche :

Date :

https://stackoverflow.com › questions › 48052217

python - How to use an async for loop to iterate over a list? - Stack ...

async for url in ['www.google.com', 'www.youtube.com', 'www.aol.com']: I can use a normal for loop but then my code will act synchronously and I lose the benefits and speed of having an async response fetching function. Is there any way I can convert a list such that the above works?

https://realpython.com › python-async-features

Getting Started With Async Features in Python

Learn how to use Python async features to write asynchronous programs that can handle multiple IO operations at once. Explore the concepts of blocking, non-blocking, cooperative concurrency and asynchronous HTTP calls with examples.

Getting Started With Async Features in Python

https://stackoverflow.com › questions › 42335754

Python Asynchronous Comprehensions - how do they work?

I'm having trouble understanding the use of asynchronous comprehensions introduced in Python 3.6. As a disclaimer, I don't have a lot of experience dealing with asynchronous code in general in Python. The example given in the what's new for Python 3.6 document is: result = [i async for i in aiter() if i % 2] In the PEP, this is ...

https://realpython.com › python-async-iterators

Asynchronous Iterators and Iterables in Python

Asynchronous iterators are what Python uses to control async for loops, while asynchronous iterables are objects that you can iterate over using an async for loop, the built-in anext() function, or an async comprehension.

https://zestedesavoir.com › articles › 3306 › plongee-au-coeur-de-lasynchrone-en-python

Plongée au cœur de l'asynchrone en Python

Dans ce tutoriel, j’aimerais vous faire découvrir ce qui se cache derrière les mots-clés async et await, comment ils s’interfacent avec asyncio. Mais aussi de quoi est faite cette bibliothèque et comment on pourrait la réécrire. Cet article présuppose une version de Python supérieure ou égale à 3.5.

https://superfastpython.com › asynchronous-comprehensions

Asynchronous Comprehensions in Python - Super Fast Python

An asynchronous comprehension allows a list, set, or dict to be created using the “async for” expression with an asynchronous iterable. We propose to allow using async for inside list, set and dict comprehensions.

Asynchronous Comprehensions in Python - Super Fast Python

https://superfastpython.com › asynchronous-iterators

Asynchronous Iterators in Python - Super Fast Python

Instead, we can use asynchronous iterators along with the async for expression to automatically await the retrieval of the next item in the iteration. In this tutorial, you will discover how to develop and use asynchronous iterators .

Asynchronous Iterators in Python - Super Fast Python

https://docs.python.org › 3 › library › asyncio-task.html

Coroutines and Tasks — Python 3.12.6 documentation

Learn how to use coroutines and tasks with the async/await syntax in Python asyncio. See examples of creating, scheduling, cancelling, and awaiting coroutines and tasks, and how to use awaitables like Futures.

https://peps.python.org › pep-0530

PEP 530 – Asynchronous Comprehensions | peps.python.org

Learn how to use async for and await expressions in list, set, dict and generator comprehensions in Python 3.6 and later. See examples, grammar updates, implementation details and references for this PEP.

https://superfastpython.com › asyncio-for-loop

Async For Loop in Python - Super Fast Python

You can develop an asynchronous for-loop in asyncio so all tasks run concurrently. There are many ways to develop an async for-loop, such as using asyncio.gather(), use asyncio.wait(), use asyncio.as_completed(), create and await a list of asyncio.Task objects and use an asyncio.TaskGroup.