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

Резултати

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

Пребарај: #temperature

当前筛选 #temperature清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #1067 · 24.11.2025 г., 12:11

🌎 The Lut Desert in Iran is one of Earth's most extreme climate zones, recording the hottest surface temperature ever measured—80.8°C in 2005 by satellite. Known as Dasht-e Lut, this salt desert has almost no vegetation or permanent water sources. ✨ #climate⚡#desert⚡#temperature 👉subscribe Interesting Planet 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #161 · 02.09.2025 г., 09:12

🌍 The Lut Desert in Iran holds the record for Earth’s hottest land temperature ever measured from space—an astonishing 80.8°C, far exceeding typical desert heat. ✨ #deserts⚡#temperature⚡#extremes⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #389 · 18.10.2025 г., 20:31

🌍 The world’s largest continental climate zone covers central Eurasia, where summers can reach above 40°C and winters drop below –40°C—a giant temperature swing found nowhere else on Earth. ✨ #climatezones⚡#temperature⚡#Eurasia⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #16 · 10.08.2025 г., 03:12

🌍 Cities often create "urban heat islands," where temperatures are higher than surrounding areas due to concrete, asphalt, and less greenery. This effect can raise cities’ temperatures by several degrees. ✨ #urbanization⚡#temperature⚡#humanimpact⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Universe Mysteries 🪐

@cosmomyst · Post #690 · 19.02.2026 г., 22:21

🪐 Uranus stands out as the coldest giant planet in the solar system, with atmospheric temperatures dipping as low as minus 224 degrees Celsius—colder than even Neptune, despite being closer to the Sun. This frigid world is also tipped on its side, with its axis tilted by about 98 degrees, so its poles almost point directly at the Sun during parts of its long, 84-year orbit. ✨ #Uranus⚡#giantplanets⚡#temperature⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​