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

Резултати

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

Пребарај: #kindness

当前筛选 #kindness清除筛选
Learn RCRussian🤍💙❤️

@learnRCRussian · Post #5825 · 13.12.2025 г., 15:00

Служба спасения сов! Owl Rescue Service! 🦉Our fighters are rescuing an owl that got tangled in the fiber-optic cable from an FPV drone. • Сова (совы) (femin.noun) [sa-va (so-vy)] An owl(s) #news #kindness 😎RCR | Support | Boost

Learn RCRussian🤍💙❤️

@learnRCRussian · Post #5821 · 12.12.2025 г., 13:00

Sometimes the world seems very difficult and complicated, doesn't it? 😽It is so difficult to remain kind and humane in our time, the harder our life is, the more pleased we are with videos where people support and understand each other, where a kind joke warms our hearts and makes our world brighter! 😽Yes, we are busy with our own affairs, burdened with problems, family events. We forget about the power of human kindness. A young girl, on her first day at work, is very worried. Every plate feels like a test, every look from the customer feels like a judgment. But instead of impatience, she is greeted with smiles. Instead of irritation, there are encouraging shouts and friendly hugs. The guests, as if sensing her vulnerability, choose sympathy. They thank and cheer her up. 😽This is a deep truth. Our strength is not in perfection, but in kindness. We offer kindness to others and choose it in ourselves. Video: Новый мир #kindness #brief_and_interesting #Russian_culture 😎RCR | Support | Boost

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40077 · 13.11.2025 г., 03:00

World Kindness Day, from the World Kindness Movement, is a universal awareness day about promoting the importance of being kind to each other, to yourself, and to the world, and is celebrated on the 13th of November every year. Celebrate by being kind online too. [Source] @googlefactss #Kindness#BeKind

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