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

Резултати

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

Пребарај: #strange

当前筛选 #strange清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #463 · 28.10.2025 г., 22:21

🪐 In the spiral galaxy NGC 3310, astronomers have observed a rare "gamma-ray burst afterglow," the fading embers following one of the universe’s brightest explosions. This lingering glow, seen in visible light and X-rays, lets scientists track how shockwaves from the original burst plow through space, revealing clues about the powerful forces unleashed when massive stars die. ✨ #gamma-ray-bursts ⚡#strange-cosmic-phenomena ⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

"Nunca habíamos visto nada igual..." Algo aterrador está sucediendo en Estados Unidos (2025) Únase a nosotros: https://anon.news 🔘En este video, el mundo quedó atónito ante la repentina aparición de un elegante monolito metálico en los remotos desiertos de Utah. Alto y silencioso, el objeto guardaba un asombroso parecido con los monolitos de 2001: Odisea del Espacio, y luego, con la misma incógnita, desapareció. Desde entonces, han aparecido docenas de estructuras similares en lugares de todo el mundo, desde las montañas nevadas de Rumania hasta las playas de California, las selvas de Colombia y los tejados de las ciudades europeas. ¿Son instalaciones artísticas, engaños elaborados o algo más enigmático? Cada monolito parece surgir sin previo aviso, a menudo en lugares de difícil acceso, y sin que nadie se atribuya la responsabilidad. Algunos son espejados y minimalistas; otros están grabados con símbolos crípticos. El fenómeno ha desatado la intriga mundial, generando teorías de conspiración, videos virales y un auge en el debate especulativo sobre la vida extraterrestre, las sociedades secretas y la conciencia colectiva. #unexplained#strange#phenomena @EndTimesProductions@Jaymez

Universe Mysteries 🪐

@cosmomyst · Post #564 · 17.12.2025 г., 22:21

🪐 One of the most mysterious cosmic events are gamma-ray bursts, or GRBs—brief, intense flashes of high-energy light detected from distant galaxies, like the spiral galaxy NGC 2770. In 2008, NGC 2770 hosted the rare GRB 080319B, which was so bright that, for about 30 seconds, it was visible to the naked eye from Earth despite being 7.5 billion light-years away, making it the most distant object ever seen without a telescope. ✨ #gamma-ray-bursts ⚡#strange-phenomena ⚡#NGC2770⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #507 · 19.11.2025 г., 12:21

🪐 In the star-forming region W51, astronomers have found “masers”—natural lasers made of microwaves—blasting out intense, focused beams from clouds of water and methanol molecules. These cosmic masers shine thousands of times brighter than any similar emission in our solar system and act like celestial signposts, marking areas where massive new stars are being born within dense, hidden clouds of gas. ✨ #strange⚡#phenomena⚡#maser⚡#starbirth⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​