Asyncio Recipes: A Problem-Solution Approach

Tahrioui, Mohamed Mustapha

  • 出版商: Apress
  • 出版日期: 2019-05-22
  • 定價: $1,250
  • 售價: 9.5$1,188
  • 貴賓價: 9.0$1,125
  • 語言: 英文
  • 頁數: 313
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1484244001
  • ISBN-13: 9781484244005
  • 相關分類: Python
  • 立即出貨 (庫存=1)

買這商品的人也買了...

相關主題

商品描述

Get the most out of asyncio and find solutions to your most troubling Python programming problems. This book offers a pragmatic collection of recipes by going beyond online resources and docs to provide guidance on using this complex library. As such, you'll see how to improve application performance and run computationally intensive programs faster.
asyncio Recipes starts with examples illustrating the primitives that come with the asyncio library, and explains how to determine if asyncio is the right choice for your application. It shows how to use asyncio to yield performance gains without multiple threads, and identifies common mistakes and how to prevent them. Later chapters cover error-handling, testing, and debugging. By the end of this book, you'll understand how asyncio runs behind the scenes, and be confident enough to contribute to asyncio-first projects.
What You Will Learn

  • Discover quirky APIs such as the event loop policies
  • Write asyncio code with native coroutines
  • Use the ast module to find legacy asyncio code
  • Work with contextvars
  • See what a async context manager is and why a lot of asyncio APIs use them


Who This Book Is For
Experienced Python developers or hobbyists who want to understand asyncio and speed up their applications by adding concurrency to their toolkit.

商品描述(中文翻譯)

充分利用asyncio,並找到解決您最困擾的Python編程問題。本書提供了一系列實用的配方,超越了線上資源和文件,提供了使用這個複雜庫的指導。因此,您將了解如何提高應用程序的性能並更快地運行計算密集型程序。

《asyncio Recipes》從示例開始,說明了asyncio庫提供的基本功能,並解釋了如何確定是否應該選擇asyncio作為應用程序的選擇。它展示了如何使用asyncio在不使用多個線程的情況下獲得性能提升,並指出了常見的錯誤以及如何預防它們。後面的章節涵蓋了錯誤處理、測試和調試。通過閱讀本書,您將了解asyncio在幕後的運行方式,並有足夠的信心參與到以asyncio為首的項目中。

您將學到什麼

- 探索奇特的API,如事件循環策略
- 使用本地協程編寫asyncio代碼
- 使用ast模塊查找遺留的asyncio代碼
- 使用contextvars
- 瞭解什麼是async上下文管理器,以及為什麼許多asyncio API使用它們

本書適合對象

有經驗的Python開發人員或愛好者,希望了解asyncio並通過將並發性添加到工具包中來加快應用程序的速度。

作者簡介

Mohamed T. is a developer of 7 years and an enthusiastic Pythonista.Using asyncio since it's advent in the 3.4 Python version as the backbone of the Smartspeaker project of the Deutsche Telekom he is well suited to show how to use asyncio in a production setting.When he is not hacking on asyncio (or bugging Yuri with his asyncio questions) he prefers to familiarise himself with the Yocto build system or read kernel changelogs.

作者簡介(中文翻譯)

Mohamed T. 是一位有七年經驗的開發者,也是一位熱衷於 Python 的愛好者。自從 asyncio 在 Python 3.4 版本中出現以來,他就一直在使用它作為 Deutsche Telekom 的 Smartspeaker 專案的核心,因此非常適合展示如何在生產環境中使用 asyncio。當他不在研究 asyncio(或者用他的 asyncio 問題困擾著 Yuri)時,他喜歡熟悉 Yocto build 系統或閱讀內核的變更日誌。