TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #402 · 22 дек.

Отдельно разберём 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

Hashtags

Резултати

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

Пребарај: #malanga

当前筛选 #malanga清除筛选
Egountchi Behanzin Officiel

@egountchibehanzinOfficiel · Post #6337 · 19.05.2024 г., 09:33

CONGO 🇨🇩 L'identité des auteurs de l'attaque ce dimanche matin dans la capitale congolaise révélée. Des images tournées par les assaillants montrent M. Christian #Malanga, membre de la diaspora congolaise résidant aux États-Unis, qui a toujours prôné le retour au #Zaïre, accompagné de son fils et de quelques personnes portant des armes à l’intérieur du Palais de la Nation. Dans une video , les assaillants ont déclarés qu’à partir d’aujourd’hui, "la RDC n'existe plus, c’est le Zaïre". @egountchibehanzinTV

MessageInABottle

@mib_messageinabottle · Post #6832 · 20.05.2024 г., 15:22

Three US citizens are accused of being involved in a failed coup attempt in #Congo that left multiple people dead. According to the Democratic Republic of Congo (#DRC) military, they stopped an attempted #coup near the presidential palace. Among the 50 people who were involved were three Americans who have been arrested. A passport for one of these Americans is now spreading online, a 36-year-old U.S. citizen born in Maryland. (WaPo) #US#Ambassador to Congo, Lucy #Tamlyn has acknowledged the involvement of US citizens in a recent statement. The coup was allegedly led by US-based Congolese politician Christian #Malanga. He was killed at the presidential palace after he resisted arrest.