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

Резултати

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

Пребарај: #rings

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

@cosmomyst · Post #12 · 29.07.2025 г., 18:51

🪐 Hidden deep inside Saturn’s rings, astronomers have discovered tiny moonlets like Daphnis that carve out delicate waves and gaps as they orbit, sculpting the rings’ sharp edges. These miniature moons cause astonishing ripples and wakes, their gravitational dance leaving patterns that shift with every pass. ✨ #Saturn⚡#moonlets⚡#rings 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #749 · 22.04.2026 г., 22:21

🪐 The galaxy Arp 147 shows off one of the universe’s strangest shapes—a bright blue ring of young stars wrapped around a reddish core, formed after a dramatic collision with another galaxy. This kind of "ring galaxy" is extremely rare, created when one galaxy punches through another, sending waves through the gas and sparking new stars to ignite in a perfect circle, making Arp 147 a cosmic example of how galactic crashes can sculpt extraordinary structures. ✨ #galaxies⚡#collisions⚡#rings⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #501 · 16.11.2025 г., 12:21

🪐 The galaxy NGC 922, located about 157 million light-years away in the constellation Fornax, sports a dramatic ring-shaped structure that formed after it collided with a smaller galaxy. This "collisional ring galaxy" features a bright, blue ring of new stars encircling its core, revealing the powerful effects of galactic crashes and creating a cosmic shape rarely found in the universe. ✨ #galaxies⚡#rings⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #687 · 18.02.2026 г., 12:21

🪐 The galaxy Hoag's Object, located about 600 million light-years away in the constellation Serpens, is a stunning example of a ring galaxy—a nearly perfect circle of bright blue stars surrounding a yellow core. This puzzling shape is believed to have formed when another galaxy passed through Hoag's Object, disrupting its stars and creating the iconic cosmic ring, a form almost never seen among the billions of known galaxies. ✨ #galaxies⚡#serpens⚡#rings⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #603 · 05.01.2026 г., 12:21

🪐 Saturn’s rings are made mostly of icy particles ranging from the size of grains of sand to mountains, but what’s remarkable is that these rings are incredibly thin—often only about 10 meters thick compared to their width of up to 282,000 kilometers. Despite their vast size, the rings would still fit comfortably within the gap between Earth and the top of our atmosphere if laid flat. ✨ #Saturn⚡#rings⚡#giants⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #103 · 09.08.2025 г., 00:11

🪐 The giant planet Saturn is the only world in our solar system with rings visible from Earth through even a small telescope, but Saturn is not alone—Jupiter, Uranus, and Neptune each have their own faint and delicate ring systems. Unlike Saturn’s bright icy rings, the rings around Jupiter, Uranus, and Neptune are darker and mostly made of dust, making them nearly invisible except with powerful spacecraft or specialized equipment. ✨ #Saturn⚡#rings⚡#Uranus⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #236 · 07.09.2025 г., 13:11

🪐 The giant planet Saturn is so light for its size that if you could find a big enough pool of water, it would float—its average density is less than water’s! Saturn's stunning ring system, made mostly of chunks of ice and rock, stretches out more than 280,000 kilometers from the planet, dwarfing the distances between many of its moons. ✨ #Saturn⚡#rings⚡#density⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​