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

Резултати

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

Пребарај: #beattheheat

当前筛选 #beattheheat清除筛选

#HealthTipMonday – Stay Hydrated, Especially in This Hot Weather! The heat right now is INTENSE 🥵 💧 Dehydration can sneak up on you, causing headaches, fatigue, dizziness, and even heat exhaustion. Staying hydrated is key to staying healthy in this heat! ✅ Drink at least 8 glasses of water daily : You lose more fluids when it’s hot, so drink up! ✅ Avoid sugary drinks : They can worsen dehydration. Stick to water, coconut water, or natural fruit juices. ✅ Carry a reusable water bottle : Always have water handy, whether at work, home, or on the go. ✅ Eat water-rich foods : Snack on watermelon, cucumbers, oranges, and pineapples to boost hydration. ✅ Watch for dehydration signs : Dry mouth, dark urine, and dizziness mean you need more water! 🚰 Don’t wait till you’re thirsty, drink water regularly! Stay cool, stay hydrated, and stay safe in this heat. #HealthTipMonday#StayHydrated#BeatTheHeat#NCDCNigeria

NEA Singapore

@NEASingapore · Post #1090 · 24.07.2025 г., 10:19

'Cause I'm gonna show you how it's done, done, done 3As don’t miss ✨ Take protective 𝗮𝗰𝘁𝗶𝗼𝗻𝘀 💧 Adjust your 𝗮𝗰𝘁𝗶𝘃𝗶𝘁𝘆 🌳🚴‍♀️ Wear appropriate 𝗮𝘁𝘁𝗶𝗿𝗲 🧢☂️ Download myENV, beat the heat! ☀️ How it's done, done, done! #BeatTheHeat#HeatStress#myENV

IRAS

@irassg · Post #1004 · 13.05.2024 г., 06:35

The weather has been so hot 🥵🔥 Who else wants to work in a cold room too? 🙋 Learn more about what Shaun and Sakthi do and why they choose #lifeatIRAS: https://www.youtube.com/watch?v=KGDBnQv31WA Find your role with us at go.gov.sg/lifeatiras💡⭐️ #WhyIDoWhatIDo#IRASGameOn#irassg#taxtech#beattheheat#careerideas