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

Резултати

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

Пребарај: #cleanpower

当前筛选 #cleanpower清除筛选
Rosatom Global

@rosatom_global · Post #123 · 20.08.2025 г., 10:26

🌟 Celebrating 80 Years of the Russian Nuclear Industry! 🌟 Today marks a historic milestone — the 80th anniversary of the Russian nuclear industry. It’s not just a story of technology and science, but of vision, resilience, and the determination to transform challenges into opportunities for the future. ⚛️ Breakthroughs that redefined possibility The Russian nuclear industry became a leader in the peaceful use of atomic energy. The world's first nuclear power plant in Obninsk was launched, created the first nuclear icebreaker and tokamak. 🚀 Rosatom today Today, the State Corporation "Rosatom" creates advanced technologies for a wide range of industries: today the state corporation not only builds nuclear power plants, providing clean energy to the country and the world, but also creates new materials — super-strong, environmentally friendly, helps develop the Arctic and the Northern Sea Route, develops nuclear medicine methods to defeat incurable diseases, advances quantum technologies to solve global human problems. 👨‍👩‍👧‍👦 A dream for the future Today, the nuclear industry has a big new dream — a long and healthy life for people through clean atomic energy, advanced nuclear medicine methods, new materials, and modern digital technologies. 🌍 We dream of a world where energy is limitless, life is healthier, and humanity thrives. And together, we will make this dream a reality. We are proud & happy! ✨ #NuclearEnergy#CleanPower#Innovation#SustainableFuture

Venture Village Wall 🦄

@venturevillagewall · Post #3646 · 21.12.2024 г., 10:24

Accelergen Energy Raises $20M Accelergen Energy has secured $20 million in funding as of December 19, 2024. The firm focuses on delivering clean power assets characterized by robust and sustainable locational value through strategic investments, development, commercialization, and optimized operations. For more details, visit Accelergen Energy. #Accelergen#Energy#Funding#CleanPower#Investment#Sustainability#RenewableEnergy#Development#Commercialization#Operations#ClimateTech#GreenEnergy#Ecosystem#Infrastructure#PowerAssets#Technology#StrategicInvestment#CleanTech#EcoFriendly#LocationalValue