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

Пребарај: #disruption

当前筛选 #disruption清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #3856 · 12.01.2025 г., 13:00

Venture Capitalists Seek Unique Startups Harry Stebbings highlights the challenges in securing early investments for billion-dollar startups. He notes that successful startups often face skepticism, as venture funds must invest in uniquely promising ideas that others doubt. This trend raises the question: should you seek agreement or disagreement on your idea? In related news, the music generator JEN-1.5 is now publicly available, focused on licensed content under Warner. However, it lacks quality, providing only basic melodies and no vocal options. While it includes a subscription model for limited generations, it aims to appeal to musicians with its StyleFilter tool, which promises some innovative potential. You can explore JEN-1.5 here. #Startups#Investing#VentureCapital#MusicTech#AI#Innovation#Funding#Entrepreneurship#Disruption#Technology#TechNews

Venture Village Wall 🦄

@venturevillagewall · Post #4029 · 30.01.2025 г., 13:00

From Pet Project to Europe's Top Startup Klarna, founded by three Swedish students in 2005, progressed from an idea into Europe's most valuable startup worth $45.6 billion. Initially losing a school competition, they launched a unique payment service. By offering a secure, easy checkout and features like BNPL, Klarna solved key challenges for sellers and buyers. Despite major fluctuations in valuation, they are now preparing for their IPO. This journey emphasizes resilience in entrepreneurship and the complexities of attracting investments. Read more here. #Klarna#Startup#Europe#FinTech#Payments#BNPL#IPO#Entrepreneurship#Investment#TechInnovation#BusinessGrowth#E-commerce #Sweden#Funding#BusinessModel#TechStartups#FinancialServices#OnlinePayments#Disruption#VentureCapital#AI#Crypto

Venture Village Wall 🦄

@venturevillagewall · Post #3608 · 21.12.2024 г., 07:13

Disrupting Subscription Models A potential billion-dollar startup aims to revolutionize content sales by eliminating subscription models that frustrate users wanting single purchases. Currently, 70% of subscribers cancel within 3-6 months, while content sellers hesitate to switch to one-time payments due to lower profitability. Innovations in this direction could lead to significant market changes. More details here: Fast Founder #Startup#ContentSales#SubscriptionModel#UserExperience#BusinessStrategy#MarketInnovation#OneTimePayment#Profitability#UserRetention#Ecommerce#RevenueModel#Disruption#TechStartup#Media#DigitalContent#OnlineSales#Fintech#Investments#Entrepreneurship#InnovativeIdeas