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

Резултати

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

Пребарај: #montenegro

当前筛选 #montenegro清除筛选
Voyage.Travel.Tourism

@VOYAGE · Post #1611 · 29.11.2025 г., 13:14

🌍Montenegro — Discover the beauty of its landscapes ⭐ Montenegro is known for its stunning mountains, crystal-clear lakes, and the beautiful Adriatic coastline. #Montenegro | @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1416 · 10.05.2025 г., 12:14

🌍Montenegro — Discover the beauty of its landscapes 📏 📏 📏 📏 📏 📏 📏 📏 ⭐ Montenegro is known for its stunning mountains, crystal-clear lakes, and the beautiful Adriatic coastline. 📏 📏 📏 📏 📏 📏 📏 📏 #Montenegro🇲🇪@voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1395 · 19.04.2025 г., 12:14

💖Kotor – a medieval gem on Montenegro’s Adriatic coast, just 22 km from Budva. A historic port with stunning bay views! 📏 📏 📏 📏 📏 📏 📏 📏 #Montenegro🇲🇪@voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1371 · 28.03.2025 г., 13:14

◾️Kotor – a city in Montenegro where medieval architecture blends with beautiful views and a resort atmosphere. 📏 📏 📏 📏 📏 📏 📏 📏 💖Founded by the Romans in the province of Dalmatia, it became a maritime port of Montenegro. 📏 📏 📏 📏 📏 📏 📏 📏 💖 Kotor is located on the Adriatic Sea coast, 22 km from Budva, and attracts tourists with its location on the Bay of Kotor. 📏 📏 📏 📏 📏 📏 📏 📏 #Montenegro🇲🇪@voyage

Hashtags

Libertà è ragione

@libertaeragione · Post #4396 · 31.07.2025 г., 12:56

#Portogallo#Palestina Primo Ministro Luís #Montenegro (#PSD|EPP): “Il Governo ha deciso di consultare Sua Eccellenza il Presidente della Repubblica e i partiti politici rappresentati nell'Assemblea della Repubblica, al fine di valutare il riconoscimento dello Stato palestinese, in una procedura che potrà concludersi durante la Settimana di alto livello dell'80ª Assemblea Generale dell’#ONU, che si terrà a New York il prossimo settembre”. @OsservatorioEsteri

12
ПретходнаСтраница 1 од 2Следна