Fluent Python (Paperback)

Luciano Ramalho

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

商品描述

Python’s simplicity lets you become productive quickly, but this often means you aren’t using everything it has to offer. With this hands-on guide, you’ll learn how to write effective, idiomatic Python code by leveraging its best—and possibly most neglected—features. Author Luciano Ramalho takes you through Python’s core language features and libraries, and shows you how to make your code shorter, faster, and more readable at the same time.

Many experienced programmers try to bend Python to fit patterns they learned from other languages, and never discover Python features outside of their experience. With this book, those Python programmers will thoroughly learn how to become proficient in Python 3.

This book covers:

  • Python data model: understand how special methods are the key to the consistent behavior of objects
  • Data structures: take full advantage of built-in types, and understand the text vs bytes duality in the Unicode age
  • Functions as objects: view Python functions as first-class objects, and understand how this affects popular design patterns
  • Object-oriented idioms: build classes by learning about references, mutability, interfaces, operator overloading, and multiple inheritance
  • Control flow: leverage context managers, generators, coroutines, and concurrency with the concurrent.futures and asyncio packages
  • Metaprogramming: understand how properties, attribute descriptors, class decorators, and metaclasses work

商品描述(中文翻譯)

Python的簡潔性讓您能夠快速提高生產力,但這通常意味著您並未充分利用它所提供的一切。透過這本實踐指南,您將學習如何透過充分利用Python的最佳特性(可能也是最被忽視的特性)來撰寫有效且符合慣用法的Python程式碼。作者Luciano Ramalho將帶領您深入了解Python的核心語言特性和函式庫,並教您如何同時使程式碼更短、更快速和更易讀。

許多有經驗的程式設計師試圖將Python彎曲成符合他們從其他語言學到的模式,卻從未發現Python在他們經驗之外的特性。透過這本書,這些Python程式設計師將全面學習如何精通Python 3。

本書涵蓋以下內容:

- Python資料模型:了解特殊方法如何確保物件的一致行為
- 資料結構:充分利用內建型別,並了解在Unicode時代中的文字與位元組的雙重性質
- 函式作為物件:將Python函式視為一等物件,並了解這如何影響常見的設計模式
- 物件導向慣用法:透過學習參考、可變性、介面、運算子重載和多重繼承來建立類別
- 控制流程:利用上下文管理器、生成器、協程以及concurrent.futures和asyncio套件實現並行處理
- 元程式設計:了解屬性、屬性描述符、類別裝飾器和元類的運作方式