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

Пребарај: #manualtransmission

当前筛选 #manualtransmission清除筛选
Auto Life

@revheadcrypto · Post #222 · 02.08.2024 г., 12:26

🚗✨Exciting News for Honda Fans!✨🚗 The Honda Civic has just unveiled its new RS version with a manual transmission! 🎉 This sporty hatchback is designed for the Japanese market and fills the gap between the standard Civic and the high-performance Type R. Key Features of the RS: 🔧 Enhanced suspension with new dampers for a firmer ride 🛠️ Improved steering for better handling 🛑 Upgraded brakes for superior stopping power 💪 Powered by a 1.5-liter engine producing 183 HP and 240 Nm of torque! 🏁💨 #HondaCivic#CivicRS#ManualTransmission#CarEnthusiast#Hatchback#Auto

Auto Life

@revheadcrypto · Post #267 · 08.08.2024 г., 07:34

🚗✨Supercar Pagani Zonda Gets a Manual Transmission!🔧 In a stunning transformation, this iconic roadster has been upgraded with a manual gearbox at the request of renowned collector Mike Iney. 🏎️💨 Powered by a monstrous 760-hp Mercedes-AMG V12 engine with a 7.3-liter displacement, this beauty is ready to deliver an unforgettable driving experience!🔥 #PaganiZonda#ManualTransmission#Supercar#CarEnthusiast#MikeIney#AMGV12#Auto

Auto Life

@revheadcrypto · Post #479 · 12.09.2024 г., 09:22

🚀Introducing the World's Most Powerful Supercar with a Manual Transmission!🏎️💨 The renowned atelier Hennessey has unveiled the new Venom F5-M roadster! 🌟 This stunning version retains the same 1842-hp V8 engine, but swaps the seven-speed automatic for a thrilling six-speed manual gearbox! 🕹️✨ The Hennessey Venom F5-M is set to be the most powerful production supercar with three pedals, starting at an incredible $2.65 million! 💰🔥 Only 12 units of the Venom F5-M will be produced, part of the exclusive batch promised in 2022. The total production of this roadster will not exceed 30 cars! 🛠️🏁 Get ready for an unparalleled driving experience! #Hennessey#VenomF5M#Supercar#ManualTransmission#PowerfulPerformance#CarEnthusiasts#LuxuryCars#LimitedEdition#Auto🚗💥