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

Резултати

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

Пребарај: #flexibility

当前筛选 #flexibility清除筛选

Flexibility has become more important to people today than sheer size. With the design for Van B UnStudio introduce new ways to make the footprint of an apartment more flexible — challenging old conventions of square footage and fixed footprints. The architectural strategy was to devise as many different ways as possible to reconfigure an apartment. To achieve this, architects designed a ‘plugin-based’ system that allows homeowners to use the space in a 40m2 apartment almost as if it were a 60m2 loft. This allows you to easily change the use of the same floor space in a matter of seconds, making it possible to transform a room from a generous office into a cozy living room, or a bedroom. Renders: Bauwerk / bloomimages #unstudio#housing#modularhousing#modularity#flexibility#inclusivedesign#germandesgin#sustainability#greenarchitecture#arch_shovel

Venture Village Wall 🦄

@venturevillagewall · Post #3360 · 18.12.2024 г., 12:07

Gander Raises $500K for AI Solutions Gander has secured a funding round of $500K, announced for December 4, 2024. The company focuses on assisting airlines in creating flexible, AI-powered workflows that enable customers to request reimbursements and compensation efficiently. #Funding#AI#Airlines#Reimbursement#Compensation#Workflows#Finance#Tech#Innovation#CustomerService#Gander#Investment#Startup#Digital#Support#Flexibility#Solutions#Technology#Efficient#CustomerExperience