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 слични објави

Пребарај: #kdf

当前筛选 #kdf清除筛选
Addis Standard

@addisstandardeng · Post #21605 · 04.03.2026 г., 08:32

News: #Ethiopia, #Kenya agree to launch joint military operations to secure border corridor, #LAPSSET Ethiopia and Kenya have agreed to strengthen security coordination along the #Moyale–#Marsabit–#Turkana corridor, endorsing structured joint military operations aimed at addressing cross-border threats and safeguarding key infrastructure linking the two countries. The agreement is part of renewed efforts to operationalise the existing Defence Cooperation Agreement (#DCA) between the two neighbours. Under the arrangement, the Ethiopian National Defence Force (#ENDF) and the Kenya Defence Forces (#KDF) are expected to undertake phased and coordinated operations targeting vulnerable border areas and strategic assets. In a related development, Ethiopia’s defence ministry also held bilateral talks with a delegation from the #Rwanda Defence Force (#RDF) on the margins of the Adwa anniversary celebrations. According to RDF, discussions focused on deepening.... Read more: https://addisstandard.com/?p=55528

跑跑資訊站 KartInfo

@KartInfoTW · Post #504 · 14.05.2023 г., 08:45

今天 KDL 緊接著登場的是團體賽決賽的對決,由 KDF 對上 LSB,兩隊可以說是世仇了,在飄移季前賽決賽再度交手! 🏁 中韓文轉播/聯賽資訊:https://kinf.cc/TR5U4 ▶️ 追蹤 Google 新聞:https://kinf.cc/gn ▶️ 立即加入 Discord:https://kinf.cc/dc #跑跑卡丁車#KartRider#跑跑飄移#KartDrift#韓服#職業#聯賽#跑跑聯賽#카트리그#KDL#Preseason#團體賽#決賽#KDF#LSB

跑跑資訊站 KartInfo

@KartInfoTW · Post #514 · 22.07.2023 г., 04:01

🔔 KDL PS2 個人賽和團體賽決賽將分別在今明兩天開打,個人賽出賽的選手有 KDF 隊員 + 其他四名選手、團體賽則是老宿主 LSB 將對上 KDF,本季同樣也有韓/英/中三語轉播,更多轉播資訊立即觀看 👇 🏁 完整聯賽資訊:https://kinf.cc/zyi0c ▶️ 追蹤 Google 新聞:https://kinf.cc/gn ▶️ 立即加入 Discord:https://kinf.cc/dc #跑跑卡丁車#KartRider#跑跑飄移#KartDrift#KDL#韓服#聯賽#跑跑聯賽#카트리그#Preseason#DDING#SPEAR#World#JiMin#SUNGBIN#Cool#NEAL#Luning#LSB#KDF#個人賽#團體賽#決賽#finals