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

Пребарај: #convertible

当前筛选 #convertible清除筛选
Car News

@car_news · Post #618 · 09.10.2024 г., 17:35

🚘 has presented modernized coupe and convertible LC The model range, produced since 2017, got slightly modernized exterior and new interior materials, but at the same time received a more rigid body. Additional struts installed under the floor in the area of the front and rear axles should favorably affect the handling. The Lexus LC engine range consists of a five-liter V8 with 477 horsepower or a 3.5-liter V6-based hybrid unit with 359 hp. Starting from $107,625. @CarsNews #Lexus#hybrid#convertible

Auto Life

@revheadcrypto · Post #298 · 10.08.2024 г., 12:16

🚗✨ Exciting News from Mercedes-Maybach! ✨🚗 Get ready for the debut of the stunning new convertible on August 15th at the prestigious Pebble Beach! 🌊🏖️ The highly anticipated model has been teased since 2022, and we can't wait to see it in all its glory! 🤩 🔍 Fuel Efficiency: The Mercedes-Maybach SL boasts an impressive fuel consumption of 13.7 liters per 100 km*, closely matching the non-hybrid Mercedes-AMG SL 63 with its powerful 4.0L V8 engine, delivering a thrilling 585 hp and 800 Nm* of torque! 💨🔥 #MercedesMaybach#Convertible#LuxuryCars#PebbleBeach#CarDebut#FuelEfficiency#AMG#V8Power#Auto