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

Резултати

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

Пребарај: #obt

当前筛选 #obt清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #468 · 05.11.2024 г., 16:11

Nothing OS 3.0 (A15) | OBT-1 for Phone (2) is here! ❗️Disclaimer 🔽 Downloads: Beta Updater (over Pong-U2.6-241016-1700) | Rollback Package (Instructions) ✍️Installation | To-Do List (Read before proceeding) ⚙️Changelogs 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2 #Pong#OBT#A15

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #184 · 09.11.2023 г., 12:05

Nothing OS 2.5 Open Beta 2 | Phone (2) | Android 14 📝 Details: - Version: 2.5 Beta 2 - Type: #NOS#OBT#A14#Beta - Codename: #Pong - Released: 02/11/23 Links: ⬇️ Download : Beta tool | Beta Package (Full) | Incremental (from beta 1) | Rollback (to 2.0.4) | TG Community Archive ⚙️ Changelogs | Official Intro 🏛Nothing Community Website 📸 Screenshots 🗒To-Do List Disclaimer: - Keep checking system updates (if you are already on beta 1). - Since this is a Beta version, there’s a very small chance the test software may interfere with your data and require a factory reset. In this instance, your data will be lost. We strongly recommend backing up all your data before accessing the software. - Rollback to NOS 2.0.4 Involves data loss, backup prior proceeding - For those getting error "ENOENT" during Android 14 Beta update: Make sure you have a folder named Documents in your storage 🔔 Updates : @NothingPhone2Updates 🐙 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #173 · 11.10.2023 г., 12:26

Nothing OS 2.5 Open Beta 1 | Phone (2) | Android 14 📝 Details: - Version: 2.5 Beta 1 - Type: #NOS#OBT#A14#Beta - Codename: #Pong - Released: 07/10/23 Links: ⬇️ Download : Beta tool | Beta Package | Rollback | Gdrive 🏛Nothing Community Website (Installation & Changelogs) 📸 Screenshots 🗒To-Do List Disclaimer: - Since this is a Beta version, there’s a very small chance the test software may interfere with your data and require a factory reset. In this instance, your data will be lost. We strongly recommend backing up all your data before accessing the software. - Rollback to NOS 2.0.3 Involves data loss, backup prior proceeding - For those getting error "ENOENT" during Android 14 Beta update: Make sure you have a folder named Documents in your storage 🔔 Updates : @NothingPhone2Updates 🐙 Chat : @NothingPhone2