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

Резултати

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

Пребарај: #suggestions

当前筛选 #suggestions清除筛选
Pensive|

@PensivePost · Post #5769 · 27.05.2022 г., 04:17

Chapter 1:The cuckoo's nest The irksome sound coming from someone's radio , "it must be morning " i muttered , tho i dont usually wake up this early on a holiday like this , so i tried to cover myself in the warmth of blanket but not enough to insulate that annoying noise and so i gave up on my dream. The sun was dim today quite unusual day for a summer . A strong pingent smell caught my glemse , after using my brain and nose i was able to find the cordinates of its origin. "Its coming from my balcony "i shouted , I jumped out of my blanket and opened the balcony , There was a dead cuckoo lying on the floor , might have fallen from its nest . I usually come to see this cuckoo been feed by a small Canary , that was a quite appealing view to watch or rather entertaining. The decaying body of cuckoo was alluring alot of bugs and ants, "Someone will live on someone's death" i said on a quavering voice , My neighbour was also in his balcony watching that cuckoo's , his balcony was just 1 feet away from mine . Unlike me his balcony was been decorated with lot of flowers , pot were hanging on the side of his wall. A green fluffy carpet all over his wall, giving more athestic look to his balcony , on the other hand my balcony have alot of poops of the birds which i never bothered to clean , a rusty chair which got its rust by weting in the rain , some clothes hanging here and there , being just 1 feet away and paying the same rent there was a lot of difference in our balconies , or rather alot of difference in our personality . He usually come to water his plants tho we never talked before. After spending few more minutes in balcony gloring the blueness of sky , I went back to my room , my stomach was starving by the time , I quickly went to check on my fridge for something to eat , even my bad luck is unlucky ,it just contains some rotten yogurts , broken beer bottles , a pouch of sous which is expired , a frozen fish . I went to my kitchen and found that i was out of instant noodles too. #review #novel #suggestions

GitHub Trends

@githubtrending · Post #15383 · 02.01.2026 г., 11:30

#go#customer#feature_request#feedback#ideas#suggestions Fider is a simple tool for collecting customer feedback, feature requests, and votes to prioritize what users want most. Use Fider Cloud for quick managed setup or self-host it free on your servers. Customize it, invite users to suggest ideas, vote, and discuss, then update statuses like "planned" or "done" to keep them informed. This saves time guessing needs, boosts customer loyalty through engagement, and helps build better products efficiently. https://github.com/getfider/fider