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

TGINSIGHT SIMILAR POSTS

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

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

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

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

Пребарај: #hearttoheart

当前筛选 #hearttoheart清除筛选
Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #1722 · 11.10.2025 г., 04:31

🌹 Welcome to Your Daily Dose of Love & Relationship Wisdom! 🌹 Hey there, lovebirds! 💕 Whether you’re navigating the thrilling first dates, deepening a long-term bond, or healing from heartbreak, we’ve got you covered. Every day, we’ll share simple, practical tips to help you build stronger connections, communicate better, and keep the spark alive. ✨ Today’s Tip: Listen More Than You Speak Great relationships start with truly hearing each other out. When your partner talks, put away distractions, make eye contact, and show you care by asking thoughtful questions. It’s amazing how much closer you’ll feel when you really listen. Stay tuned for more heartfelt advice, fun ideas, and inspiring stories to nurture your love life. Remember, love is a journey—not a destination. Let’s walk it together! ❤️ #LoveTips#RelationshipGoals#HeartToHeart#StrongerTogether @loveandrelationshiptips

Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #1723 · 11.10.2025 г., 04:54

💡 Quick Love Quiz: What’s Your Communication Style? 💡 When you and your partner hit a rough patch, how do you usually handle it? A) Talk it out immediately — no matter what B) Need some space before discussing things C) Avoid conflict and hope it blows over D) Get emotional but try to listen Which one sounds like you? Comment your letter and tell us why! Let’s see how different styles shape our relationships and what we can learn from each other. 💬❤️ #LoveTips#RelationshipTalk#CommunicationMatters#LoveQuiz#HeartToHeart @loveandrelationshiptips

Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #1726 · 11.10.2025 г., 08:30

💬 Let’s Talk Heart-to-Heart 💬 True connection happens when we drop the masks and speak from the heart. A heart-to-heart isn’t just about sharing words—it’s about being vulnerable, honest, and open to understanding each other deeply. It’s in these moments that trust grows and relationships transform. Next time you feel the need to connect, try this: pause, breathe, and share what’s really on your mind and in your heart. You might be surprised how much closer it brings you. Remember, every meaningful relationship thrives on genuine conversations. So, don’t hesitate—open up and listen with your heart. ❤️ #HeartToHeart#DeepConnections#RealTalk#LoveAuthentically#SpeakYourTruth @loveandrelationshiptips