Effective Python: 59 Specific Ways to Write Better Python (Paperback)

Brett Slatkin

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

相關主題

商品描述

It's easy to start writing code with Python: that's why the language is so immensely popular. However, Python has unique strengths, charms, and expressivity that can be hard to grasp at first -- as well as hidden pitfalls that can easily trip you up if you aren't aware of them. Effective Python will help you harness the full power of Python to write exceptionally robust, efficient, maintainable, and well-performing code. Utilizing the concise, scenario-driven style pioneered in Scott Meyers's best-selling Effective C++, Brett Slatkin brings together 59 Python best practices, tips, shortcuts, and realistic code examples from expert programmers.

Through realistic examples, Slatkin uncovers little-known Python quirks, intricacies, and idioms that powerfully impact code behavior and performance. You'll learn how to choose the most efficient and effective way to accomplish key tasks when multiple options exist, and how to write code that's easier to understand, maintain, and improve.

Drawing on his deep understanding of Python's capabilities, Slatkin offers practical advice for each major area of development with both Python 3.x and Python 2.x. Coverage includes:

  • Algorithms
  • Objects
  • Concurrency
  • Collaboration
  • Built-in modules
  • Production techniques
  • And more

Each section contains specific, actionable guidelines organized into items, each with carefully worded advice supported by detailed technical arguments and illuminating examples. Using Effective Python, you can systematically improve all the Python code you write: not by blindly following rules or mimicking incomprehensible idioms, but by gaining a deep understanding of the technical reasons why they make sense.

商品描述(中文翻譯)

使用Python開始編寫程式很容易,這也是為什麼這個語言如此受歡迎的原因。然而,Python具有獨特的優勢、魅力和表達能力,初學者可能很難理解,同時也存在一些隱藏的陷阱,如果不注意的話很容易出錯。《Effective Python》將幫助您充分利用Python的優勢,編寫出非常堅固、高效、易於維護和性能優越的代碼。作者Brett Slatkin借鑒了Scott Meyers暢銷書《Effective C++》中的簡潔、場景驅動的風格,匯集了59個Python最佳實踐、技巧、快捷方式和來自專業程序員的實際代碼示例。

通過實際示例,Slatkin揭示了Python中鮮為人知的怪異之處、細節和慣用法,這些對代碼行為和性能有強大影響。您將學習如何在多個選項存在時選擇最高效和最有效的完成關鍵任務的方式,以及如何編寫更易於理解、維護和改進的代碼。

基於對Python能力的深入理解,Slatkin提供了在Python 3.x和Python 2.x中進行開發的各個主要領域的實用建議。內容包括:

- 算法
- 對象
- 並發性
- 協作
- 內置模塊
- 生產技術
- 等等

每個部分都包含具體可行的指南,這些指南被組織成項目,每個項目都有精心措辭的建議,並有詳細的技術論證和啟發性的示例。使用《Effective Python》,您可以系統地改進您編寫的所有Python代碼:不是盲目遵循規則或模仿難以理解的慣用法,而是通過深入理解它們在技術上的合理性來提升。