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

Резултати

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

Пребарај: #tides

当前筛选 #tides清除筛选
Bali News

@balinews · Post #81 · 09.06.2024 г., 10:59

🌊 Bali authorities warn of high tides 🌤 Bali's Meteorology, Climate and Geophysics Agency is warning of extreme weather conditions for several days. In particular, of extremely high tides on the southern coast of the island. ❌ The population and tourists are advised to temporarily refrain from bathing on the beach of Kuta. @BaliNews #weather#tides#Kuta

Interesting Planet 🌍

@interesting_planet_facts · Post #711 · 08.09.2025 г., 16:22

🌎 In Australia’s Kimberley region, the Horizontal Falls are created when huge tidal currents force seawater through narrow rock gorges, producing powerful, temporary waterfalls that appear to flow sideways. Tides here can rise over 10 meters, creating one of the world’s most unusual tidal phenomena. ✨ #tides⚡#waterfalls⚡#Australia 👉subscribe Interesting Planet ​

Amazing Geography 🌍

@amazingeo · Post #265 · 19.09.2025 г., 13:12

🌍 Earth’s tides are driven mostly by the Moon’s gravity, causing oceans to rise and fall all over the globe. These constant movements help mix ocean waters and shape coastal ecosystems. ✨ #tides⚡#ocean⚡#cycles⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #318 · 01.10.2025 г., 12:31

🌍 The Wadden Sea along Europe’s North Sea coast is the world’s largest tidal mudflat system. Twice daily, the sea retreats for kilometers, revealing vast sandbanks and rich habitats for millions of migratory birds. ✨ #coastline⚡#tides⚡#wildlife⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #617 · 06.02.2026 г., 20:31

🌍 The Bay of Fundy in eastern Canada experiences the highest tidal range on Earth—up to 16 meters between high and low tide. These extreme tides carve dramatic coastal cliffs and ever-changing mudflats. ✨ #tides⚡#coast⚡#landscape⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​