TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #401 · 15 дек.

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

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

Пребарај: #webgpu

当前筛选 #webgpu清除筛选
GitHub Trends

@githubtrending · Post #14810 · 08.06.2025 г., 14:00

#rust#d3d12#gpu#hacktoberfest#metal#opengl#rust#vulkan#webgpu **wgpu** is a powerful graphics library for Rust that works on many platforms, including Windows, macOS, Linux, and the web. It supports various graphics APIs like Vulkan, Metal, and DirectX. This library is safe and portable, making it easy to create graphics and compute applications. Using **wgpu**, you can build fast and efficient graphics programs that run on different devices and browsers, which is beneficial for developers who want to create cross-platform applications. https://github.com/gfx-rs/wgpu

GitHub Trends

@githubtrending · Post #14898 · 02.07.2025 г., 13:30

#javascript#3d#augmented_reality#canvas#html5#javascript#svg#virtual_reality#webaudio#webgl#webgl2#webgpu#webxr Three.js is a powerful and easy-to-use JavaScript library that helps you create 3D graphics and animations on the web with much less code than using WebGL directly. It handles complex tasks like rendering and math calculations, so you can focus on designing your 3D scenes. It supports WebGL and WebGPU, with additional options like SVG and CSS3D. Three.js has excellent documentation, many examples, and a large, active community that provides support and updates. This makes it ideal for quickly building interactive 3D content that works across browsers, improving your web projects with engaging visuals and smooth performance[1][3][5]. https://github.com/mrdoob/three.js

GitHub Trends

@githubtrending · Post #15296 · 12.11.2025 г., 13:30

#javascript#3d_gaussian_splatting#game_development#game_engine#gamedev#gaussian_splatting#gltf#hacktoberfest#javascript#nodejs#playcanvas#typescript#virtual_reality#webgl#webgl2#webgpu#webxr PlayCanvas is an open-source game engine that lets you create 3D and 2D games or apps that run in any browser, using WebGL and WebGPU for fast, high-quality graphics. It supports advanced features like animation, physics, sound, and asset streaming, and you can write code in JavaScript or TypeScript. The engine is free, easy to set up, and works well for both simple projects and complex games, making it simple to build and share interactive content online. https://github.com/playcanvas/engine