Отдельно разберём 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
The Co-optation of Continental Institutions: Abiy Ahmed’s Faustian Bargain with IGAD and the AU, and Its Inevitable Backfire on Ethiopian Stability. Read more.
https://borkena.com/2025/12/04/the-co-optation-of-continental-institutions-abiy-ahmeds-faustian-bargain-with-igad-and-the-au-and-its-inevitable-backfire-on-ethiopian-stability/#Ethiopia#politics#Africa#Institution
Ethnos to Demos: The Vision Confirmed, The Path Diverges. Read more.
https://borkena.com/2025/12/15/ethiopia-ethnos-to-demos-the-vision-confirmed-the-path-diverges/#Ethiopia#politics#institution#ethnicfederalism
📊Sanksiyani bartaraf etish, mintaqaviy integratsiya va institutlar
🟣Oliy maktabda Qozog‘iston Respublikasining Narxoz Universiteti professori Murat Issabayev ishtirokida “Sanksiyani bartaraf etish, mintaqaviy integratsiya va institutlar” mavzusidagiilmiy seminar bo‘lib o‘tdi.
💬Sanction Mitigation, Regional Integration, and the Role of Institutions
🟣The Graduate School hosted a scientific seminar titled "Sanctions Mitigation, Regional Integration, and Institutions," featuring Professor Murat Issabayev from Narxoz University, Kazakhstan.
🏙Устранение санкций, региональная интеграция и институты
🔴В Высшей школе состоялся научный семинарна тему «Устранение санкций, региональная интеграция и институты» с участием профессора Нархозского университета Республики Казахстан Мурата Иссабаева.
#GraduateSchool#Sanction#Integration#Institution
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
Fed's Role in Bitcoin Reserve Plans
Discussions arise on the establishment of a Bitcoin Strategic Reserve (BSR) if Trump decides to act quickly. The U.S. Treasury could use the Exchange Stabilization Fund to purchase Bitcoin via an executive order. Long-term stability requires congressional legislation to include Bitcoin in the Strategic Reserve Act. Both steps are Treasury-led, firmly placing the Federal Reserve outside of this decision-making process.
In another noteworthy development, blockchain project Trrue has secured a $10 million investment commitment from GEM Digital, despite GEM's background of fraudulent activity, raising concerns over transparency in reporting.
Read more: Wu Blockchain News | CoinDesk | Wu Blockchain News
#Fed#Bitcoin#BSR#UStreasury#ExecutiveOrder#Trrue#Investment#GEMDigital#Fraud#Blockchain#Transparency#Congress#ReserveAct#Crypto#Finance#News#Regulation#Market#Tokens#Ecosystem#Institution