Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11.
Ключевые отличия
▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля
▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста
▫️ошибка автоматически отменяет незавершенные задачи,
▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно
import asyncio
import random
async def do_it() -> str:
if random.random() < 0.1:
raise ValueError('Oops')
delay = random.uniform(0.5, 1.5)
await asyncio.sleep(delay)
return delay
async def main():
try:
async with asyncio.TaskGroup() as tg:
for _ in range(10):
tasks.append(tg.create_task(do_it()))
for t in tasks:
print(t.result())
except *ValueError as e:
for err in e.exceptions:
print(err)
asyncio.run(main())
Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов
- таймауты
- отмена задач
- создание задач из другого потока
#async
🌐Climate Tech Gets an AI Upgrade!
AI isn’t just about chatbots and robots — it’s now being used to fight climate change.🌱
Recent breakthroughs show AI can:
✔️ Predict extreme weather with higher accuracy.
✔️ Optimize energy grids for renewable power.
✔️ Reduce waste in agriculture and water usage.
✔️ Help cities design smarter, greener infrastructure.
This could mean billions saved in disaster response and a faster transition to clean energy.
But… the big question is: Will governments and companies adopt it fast enough?⌛
Would you trust AI to manage your city’s energy?
➖➖➖➖🔻
🧠 BOT: @Chatgpt_OfficialBOT
💎@Chatgpt_OfficialNews
#️⃣#AI#ClimateTech#Innovation#NeuralHubAI
➖➖➖➖🔺
In Iceland, the CarbFix project captures CO2 from geothermal power plants. The CO2 is mixed with water and injected deep underground into basalt rock. It reacts with minerals in the rock and forms stable carbonate rock. The system has been operating at the Hellisheiði geothermal power plant.
🪨🌍💧⚗️
[Read more]
@googlefactss
#CarbonCapture#Iceland#CO2#ClimateTech
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
#The_Time🇺🇸📕[PDF]⬇️
27 #October2025
#Weekly_Magazines
For learning, for free(dom).
@backupofmagazines
Meet the #Future of invention in TIME’s Best Inventions of 2025! 🤖 From humanoid robots folding laundry (#AI), to lab-grown #salmon, wildfire defense tech, and personalized #healthcare, this issue showcases 50+ breakthroughs that redefine home, work, and #sustainability. Discover how #FigureAI leads the #robotics revolution, dive into the #Barbie phenomenon, explore the rise of “Baby Boxes,” and relive the final #StrangerThings. A must-read collection for #tech lovers and #innovators alike.
#BestInventions2025#Innovation#FutureOfWork#ClimateTech#Biotech#Netflix#HumanAI#TimeMagazine