TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #401 · 15 дек.

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #theparallel

当前筛选 #theparallel清除筛选

🎙Long waited testnet for Parallel is ON🔥🔥🔥 🎮TESTNET FOUNDATION GAME: PARAGON CRAFTING🎮 ➧REGISTER NOW! ⚖️Requirement: Have at least 1000 PRL in Wallet BUY NOW: https://poocoin.app/tokens/0xd07e82440a395f3f3551b42da9210cd1ef4f8b24 👉Registration Form: https://prl.onl/testnetform ⏰Registration Open: Jan 6, 2022 - Jan 10, 2022 ⏰Valid Wallet Scan: 13:00 UTC on Jan 10, 2022 #TheParallel#Metaverse#PRL

🔥🔥🔥ARE YOU READY? JUST 20 minutes LEFT There is nothing more excited than waiting for the Super Listing Event from The Parallel at the moment. Do not miss us! Set your alarm at 13:00 UTC right now, Parallese. Events on the Super Listing Event you should pay attention!! 👉 SQuizz Game on Livestream 🎁 20,000 PRL for the 200 people have the highest score Step 1: Log in to your MetaMask wallet address at theparallel.io Step 2: Follow the Super Listing event and wait for the questions to appear randomly throughout event time (15 questions in total) Step 3: Answer the questions at theparallel.io 👉 Share NOW - Earn NOW - 🎁 20,000 PRL for 1,000 fastest Parallese sharing and $1000 for 1 luckiest one Step 1: Share the Livestream on Facebook or Twitter with the hashtag #TheParallel#Super_Listing_Event#Metaverse#PRL Step 2: Tag 5 of your friends in the comment section Step 3: Enter the link of your sharing post and your wallet address at: https://t.me/prlsharenowbot 📌 Listing time: Revealed in the Livestream. You must watch the full live stream to find out 🔐 PRL smart contract address: 0xd07e82440A395f3F3551b42dA9210CD1Ef4f8B24 1️⃣ Install BEP-20 Wallet (Metamask) 2️⃣ Adding PRL smart contract before Listing will help shorten transaction time and increase fair competition with bots. 3️⃣ Prepare BUSD, BNB in your wallet and approve BUSD in PancakeSwap 📎 Find out details at: https://prl.onl/3FqvCrh

🎙The Parallel - An Infinite Metaverse announcement🔥🔥 The Parallel - An Infinite Metaverse@theparallel_io Feb 23👑 Check Out Rune Hunter: Ascension! First game launched by The Parallel Metaverse 👉Read the game guide! We want your first impressions and thoughts! 👉Checkout Ascension NOW:https://prl.onl/3LU3xfv ⏰ ETA: Mid March Testnet #Gamefi#playtoearn$PRL #PRL#theparallel#Ascension