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

Резултати

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

Пребарај: #elixir

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

@githubtrending · Post #15106 · 30.08.2025 г., 13:00

#elixir#elixir#language_server_protocol#lsp Expert is the official language server for Elixir, helping your code editor understand and work with Elixir code better. You can easily install it by downloading the right version for your system or build it from source if you prefer. Expert supports the latest features through nightly builds and integrates smoothly with your editor, improving coding with features like error checking and code completion. Using Expert makes writing Elixir code faster and less error-prone, boosting your productivity and coding experience. It is open source under Apache License 2.0 and supported by sponsors, ensuring ongoing development and support. https://github.com/elixir-lang/expert

GitHub Trends

@githubtrending · Post #15032 · 06.08.2025 г., 11:30

#elixir#debug_adapter_protocol#elixir#language_server#language_server_protocol#lsp ElixirLS is a tool that helps you write and debug Elixir code more easily by providing features like code completion, go-to-definition, inline error reporting, and a powerful debugger that supports breakpoints and step-through debugging. It works with many editors and IDEs through standard protocols, making it flexible to use. It also integrates Dialyzer for static code analysis to catch bugs early and offers a server that helps AI tools understand your code better. Using ElixirLS speeds up development, improves code quality, and makes debugging simpler and more efficient. It supports recent Elixir and OTP versions and can be customized for your project needs. https://github.com/elixir-lsp/elixir-ls

GitHub Trends

@githubtrending · Post #15545 · 07.03.2026 г., 12:30

#elixir#agent#ai#artificial_intelligence#elixir#event_driven_architecture#functional_programming#orchestration#workflow Jido is a pure functional framework for Elixir to build autonomous multi-agent workflows. Agents are immutable data with a simple `cmd/2` function that transforms state purely and outputs directives for effects like signals or spawning, handled by OTP runtime. It formalizes patterns like standard signals, reusable actions, and hierarchies over raw GenServer, adding AI tools, strategies (ReAct, FSM), and supervision. You benefit by creating scalable, testable, fault-tolerant agent systems easily for production AI apps, saving reinvented code. https://github.com/agentjido/jido