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

Пребарај: #unday

当前筛选 #unday清除筛选
Statistica Moldovei

@statisticamd · Post #875 · 24.10.2024 г., 12:55

🌐 Astăzi, 24 octombrie, este celebrată Ziua Națiunilor Unite 🇺🇳. 🤝 Biroul Național de Statistică adresează sincere felicitări organizațiilor ONU Moldova și mulțumiri pentru că ne sunt alături și ne oferă suport continuu în vederea consolidării capacităților sistemului statistic național și modernizării producției și diseminării datelor statistice de calitate, în corespundere cu standardele internaționale. #ZiuaONU#UNDay

🇰🇬🇺🇳 Кыргыз Республикасы эл аралык коомчулук менен катар БУУнун күнүн белгиледи 🇰🇬🇺🇳 Кыргызская Республика присоединяется к мировому сообществу в праздновании Дня Организации Объединенных Наций 🇰🇬🇺🇳 The Kyrgyz Republic joins the international community in celebrating United Nations Day #UNDay#UN#UnitedNations#ООН 🔗 Толугураак / Подробнее: mfa.gov.kg LinkedIn | Instagram | X (Twitter) | Facebook | YouTube

Yoshlar Markazi | Ziyo Forum

@YouthCenterZiyo · Post #1050 · 29.10.2025 г., 09:32

☀️ “Ziyo Forum” yoshlar markazida BMT kuni munosabati bilan “Youth United for the UN Day: Empowering Sustainable Future” sessiyasi bo‘lib o‘tdi! 🇺🇳27-oktabr kuni “Ziyo Forum” yoshlar markazida yoshlar uchun ilhomlantiruvchi sessiya tashkil etildi. Tadbir davomida Alisher Asrorov— UNODC Youth Network Leader in Uzbekistan, Webster Universitetining Career & Business Development menejeri va sobiq BMT Yoshlar Kengashi raisi — BMTning O‘zbekistondagi faoliyati, Barqaror Rivojlanish Maqsadlari (SDGs) hamda yoshlarning global tashabbuslardagi o‘rni haqida o‘z tajribasi asosida so‘zlab berdi. 📌Ishtirokchilar ochiq muloqotda faol qatnashib, “Kahoot” viktorinasida o‘z bilimlarini sinovdan o‘tkazishdi. Tadbir yakunida eng faol yoshlarga maxsus sovg‘alar topshirildi va umumiy suratga tushildi. 🌍Sessiya iliq va ilhomlantiruvchi muhitda o‘tib, yoshlarni global fikrlash va barqaror kelajak sari ilhomlantirdi. 📸 Barcha suratlarni quyidagi havola orqali ko‘rishingiz mumkin: 👉https://disk.yandex.ru/d/1A8GU1Uc6bujhg ☀️ “Youth United for the UN Day: Empowering Sustainable Future” session was successfully held at Ziyo Forum Youth Center! 🇺🇳On October 27, a special and inspiring session took place at the Ziyo Forum Youth Center. Alisher Asrorov— UNODC Youth Network Leader in Uzbekistan, Career & Business Development Manager at Webster University, and former Chair of the UN Youth Advisory Board — shared his insights on the UN’s role in Uzbekistan, the Sustainable Development Goals (SDGs), and the importance of youth participation in global initiatives. 📌Participants actively engaged in open discussions and tested their knowledge through the interactive Kahoot quiz. The most active attendees received special gifts, and the event concluded with a group photo. 🌍The session took place in a warm and inspiring atmosphere, motivating young people to think globally and contribute to a sustainable future. 📸 Check out all the event photos at the link below: 👉https://disk.yandex.ru/d/1A8GU1Uc6bujhg #ZiyoForum#UNDay#YouthEmpowerment#SustainableFuture#UNUzbekistan#SDGs#YouthCenter