atlas news
    
Super Fast Python
14  mai     19h00
Asyncio gather() Return Values
Jason Brownlee    We can retrieve return values from coroutines executed concurrently by asyncio.gather . The asyncio.gather function returns an asyncio.Future that executes all provided coroutines concurrently. Once the asyncio.Future is done, it returns a list that contains one return value for each coroutine...
12  mai     19h00
Asyncio gather() In The Background
Jason Brownlee    We can run asyncio.gather in the background by not awaiting the call to asyncio.gather . The asyncio.gather returns an asyncio.Future that does not have to be awaited. It is scheduled for execution in the asyncio event loop, along with all coroutines provided to the gather. Therefore, the...
09  mai     19h00
Asyncio gather() Limit Concurrency
Jason Brownlee    We can limit concurrency when using asyncio.gather via a semaphore. In this tutorial, you will discover how to limit concurrency with asyncio.gather . Let’s get started. Need to Limit Concurrency with asyncio.gather The asyncio.gather function allows us to run multiple coroutines or tasks...
07  mai     19h00
Asyncio gather() Exception in Task Does Not Cancel
Jason Brownlee    We can execute coroutines concurrently with asyncio.gather . By default, an exception in asyncio.gather will be propagated to the caller immediately. The asyncio.gather call will not wait for the other coroutines to complete, and it will not cancel the other tasks. It is critically important...
05  mai     19h00
Asyncio gather() Timeout
Jason Brownlee    We can add a timeout when using asyncio.gather via the asyncio.timeout context manager. A timeout in seconds can be specified to the asyncio.timeout context manager and the asyncio.gather function can be called within the context manager block. If the timeout elapses before all tasks in the...
02  mai     19h00
Asyncio Shield Main Coroutine From Cancellation
Jason Brownlee    We can simulate shielding the main coroutine from cancellation by using a wrapper coroutine that consumes cancellation requests. In this tutorial, you will discover how to shield the main coroutine from cancellation. Let’s get started. Need to Shield The Main Coroutine From Cancellation Asyncio...
30  avril     19h00
Asyncio Run Multiple Concurrent Event Loops
Jason Brownlee    We can run multiple concurrent asyncio event loops by starting and running each new event loop in a separate thread. Each thread can host and manage one event loop. This means we can start one thread per event loop we require, allowing a program to potentially scale from thousands to millions of...
28  avril     19h00
Asyncio gather() TypeError: unhashable type: list’
Jason Brownlee    We can avoid a TypeError exception when using asyncio.gather by unpacking the collection of awaitables with the star operator. The asyncio.gather function is used to execute multiple coroutines concurrently and return a list of return values once all tasks are done. The function will fail...
25  avril     19h00
Asyncio Event Loop in Separate Thread
Jason Brownlee    We can run an asyncio event loop in a new thread by starting a new thread and configuring it to start or run an event loop. There are many approaches we can use to run an event loop in a new thread. The simplest is to configure a new thread to start an event loop
23  avril     19h00
Asyncio gather() Handle Exceptions
Jason Brownlee    We can automatically handle exceptions in coroutines executed via asyncio.gather by setting the return exceptions argument to True. By default, if a coroutine is executed by asyncio.gather fails with an unhandled exception, it will be propagated to the caller. Setting the return exceptions ...