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 слични објави

Пребарај: #makeadifference

当前筛选 #makeadifference清除筛选
NewUU Student Council

@newuu_sc · Post #1460 · 08.02.2025 г., 07:37

🌍 SDG Week: The SDG Nexus – Connecting People and Purpose 🌱 Get ready for an inspiring journey towards a sustainable future! 🌏✨ Join us at Webster University in Tashkent for SDG Week, where you’ll engage with global experts, take part in interactive workshops, and explore how YOU can make a difference in achieving the Sustainable Development Goals. 📆Date: February 10-12 📍Location: Webster University in Tashkent 🕛Time: 12:00 p.m. What to Expect? 📅Day 1: Opening Conference & Networking 🎤 Kick off SDG Week with a powerful conference featuring 5 international universities, a United Nations representative, and leading experts in the field of SDGs. 🤝 Connect with like-minded individuals passionate about sustainability and change. 📅Day 2: Eco Health & Sport Day 🌱 Learn from eco-activist Urikguli (Mutabar Xushvaqtova) in an engaging workshop on environmental sustainability and its impact on our well-being. ⚽ The session will be followed by exciting sports matches to promote health and sustainability. 📅Day 3: Hands-On Workshops & Action Planning 💡 Dive deeper into real-world solutions through interactive workshops, where you’ll develop actionable strategies to contribute to sustainable development. 🍕Special snacks will be provided between networking sessions!🤫 🚀Want to actively contribute to the event? If you have an idea, project, or expertise related to the SDGs and would like to be a part of the program as a speaker, organizer, or contributor, fill out this form: 📢Contribute to SDG Week:https://forms.gle/ReaaTpPMP5W41KwW8 🔗Register as a participant:https://forms.office.com/r/QVFg4ZFZy8?origin=lprLink 📢Join the SDG Club:https://t.me/sdgclubwebster #SDGWeek#SustainableDevelopment#MakeADifference#PeopleAndPurpose

INHA University in Tashkent

@inha_uz · Post #8528 · 20.01.2025 г., 12:05

🌟 Join Us in Supporting the Children’s Hospice! 🌟 🗓Date: 25th of January 📍 Gathering Point: INHA University at 9:00 AM This event is dedicated to bringing love, care, and support to children in the hospice during their most challenging times. Let's come together to make a difference in their lives! ❤️ Your contributions and time as a volunteer can truly bring hope and smiles. 💬How to Help: ✅ Donate: Every little contribution matters 9860 3501 4923 6621(Aleksandra Kim) ✅ Volunteer: Be part of this meaningful event. For more details: @iut_charityy Let’s create a wave of kindness and show these children that they are not alone! 💕 #CharityEvent#ChildrenHospice#Volunteer#IUTCharity#MakeADifference

Real Eco Committee

@real_eco · Post #4 · 15.04.2026 г., 07:56

🌱 Join our Eco Committee! Want to make a real difference for the environment? 🌍💚 If you're interested in being part of our project, come to our Thursday school eco volunteering meeting! Let’s work together for a greener future 🌿✨ #EcoCommittee#EcoClub#GoGreen#Sustainability#SaveThePlanet#EcoFriendly#SchoolLife#Volunteer#ClimateAction#GreenFuture#EnvironmentalAwareness#ActNow#StudentsForChange#MakeADifference#EcoWarriors