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

Резултати

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

Пребарај: #tp6anni

当前筛选 #tp6anni清除筛选
TokenPocket

@tokenpocket_channel · Post #1325 · 16.04.2024 г., 07:14

🎇Happy #TP6Anni!! 💙Join our 6th Anniversary Celebration and win OVER $10,000 Rewards! Dive into👇 https://app.galxe.com/quest/TokenPocket/GCwbMtTHJW 💪We would like to express our gratitude to all TP users and partners, and we hope to work together with you in the future to create a new era of blockchain! ❤️Thank BitlayerLabs, MerlinSwap, cyclenetwork_GO, and TNA_Protocol for supporting the 1st round of the #TP6Anni celebration! Stay tuned for more!

Hashtags

TokenPocket

@tokenpocket_channel · Post #1336 · 07.05.2024 г., 09:27

💙Thanks to all the #TPFam who participated in the #TP6Anni celebration! 🏆Check if you are on the #TP6Anni Giveaway Winner List! 1️⃣ 50 BitlayerLabs Lucky Helmet NFT 👉https://docs.google.com/spreadsheets/d/1qjIkzt1_CM_LfNaoy4vVIrqSmB5hF4oAN5pIScYgeQM/edit#gid=0 2️⃣ $2,000 esMP token Giveaway 👉https://docs.google.com/spreadsheets/d/1tt_AiQmQYZk3EFS-6hEwTZFBI0iTcJDK6YD110TZeQU/edit#gid=0 3️⃣1,000 Piggy Boxes V3 Giveaway 👉https://docs.google.com/spreadsheets/d/1_Aj9cgq0SdyJHQjztl-TWGwHQb_NHgWIbaonwzSH7vA/edit#gid=0 4️⃣$3,000 $TNA and 50 Tapnames Whitelists Giveaway 👉https://docs.google.com/spreadsheets/d/1ZiCOS_nQ897Vj5p5TgoMi607hCCk2IILhwVn6-w-MjE/edit#gid=0 💙Thanks for your participation! If you have any questions, please join https://t.me/tokenPocket_en.

TokenPocket

@tokenpocket_channel · Post #1326 · 17.04.2024 г., 07:02

🎇Happy #TP6Anni!! 💙Join and win 50 BitlayerLabs Lucky Helmet NFT Whitelists Giveaway on Galxe! 👉https://app.galxe.com/quest/TokenPocket/GCddyth8TC 🟧Bitlayer Lucky Helmet is the official NFT launched by BitlayerLabs, a symbol of identity representing the contributions of builders in the Bitlayer community. #TP6Anni#TokenPocket#Bitlayer

TokenPocket

@tokenpocket_channel · Post #1332 · 26.04.2024 г., 08:04

🎇Happy #TP6Anni!! 💙Join and win $2000 esMP Tokens Giveaway on Galxe! 👉https://galxe.com/TokenPocket/campaign/GCyyEths19 🟧MerlinSwap stands as the 1# Decentralized Exchange in the #Bitcoin ecosystem, aimed to become the liquidity hub for BTC and Bitcoin eco-assets, including #BRC20, #BRC420 and native tokens across MerlinLayer2 Bitcoin layer2.