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

Резултати

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

Пребарај: #inspiring

当前筛选 #inspiring清除筛选
Inspiring Images

@InspiringImages · Post #13417 · 19.09.2025 г., 03:41

Really Good One to Watch The daughter takes a step forward with each question. The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress. When the father steps forward for the final question, she hugs him. Father - Daughter ❤️ Children can be raised without knowing hardship. But it is important to make them know that nothing they get comes so easily ❤️ #Inspiring @InspiringThoughts

Hashtags

Inspiring Thoughts

@Inspiringthoughts · Post #10978 · 19.09.2025 г., 03:38

Really Good One to Watch The daughter takes a step forward with each question. The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress. When the father steps forward for the final question, she hugs him. Father - Daughter ❤️ Children can be raised without knowing hardship. But it is important to make them know that nothing they get comes so easily ❤️ #Inspiring @InspiringThoughts

Hashtags

Inspiring Thoughts

@Inspiringthoughts · Post #10694 · 26.03.2025 г., 04:55

Who is your life partner? Listen in quiet times @InspiringThoughts Give 👍 if you like it Let us see how many understand hindi #Inspiring

Hashtags

椒盐豆豉剪报

@mtfront · Post #3744 · 07.01.2025 г., 08:34

今晚和女朋友聊天想出的鸡汤一则:焦虑型的人要担心和伤心的是 O(n),但我这种不焦虑型的发生了再兵来将挡水来土掩的焦虑量只有 O(log n),所以刷过题知道我在说什么的朋友们焦虑的时候可以拿算法试图稍微缓给不焦虑这边加加分! (甚至不知道该打什么 tag,本剪报还没有这么鸡汤过,那就强行 #inspiring 吧)

Hashtags

Most Inspiring

@MostInspiring · Post #2793 · 19.09.2025 г., 03:42

Really Good One to Watch The daughter takes a step forward with each question. The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress. When the father steps forward for the final question, she hugs him. Father - Daughter ❤️ Children can be raised without knowing hardship. But it is important to make them know that nothing they get comes so easily ❤️ #Inspiring @InspiringThoughts

Hashtags

Most Inspiring

@MostInspiring · Post #2792 · 19.09.2025 г., 03:40

Really Good One to Watch The daughter takes a step forward with each question. The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress. When the father steps forward for the final question, she hugs him. Father - Daughter ❤️ Children can be raised without knowing hardship. But it is important to make them know that nothing they get comes so easily ❤️ #Inspiring @InspiringThoughts

Hashtags

Positive News

@positivenewss · Post #526 · 19.09.2025 г., 03:41

Really Good One to Watch The daughter takes a step forward with each question. The father stands there. The daughter, who starts off playfully laughing.... is shocked to see her father standing there despite her progress. When the father steps forward for the final question, she hugs him. Father - Daughter ❤️ Children can be raised without knowing hardship. But it is important to make them know that nothing they get comes so easily ❤️ #Inspiring @InspiringThoughts

Hashtags

ПретходнаСтраница 1 од 3Следна