Effective Python: 90 Specific Ways to Write Better Python, 2/e (Paperback)

Slatkin, Brett

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

相關主題

商品描述

Updated and Expanded for Python 3

It’s easy to start developing programs with Python, which is why the language is so popular. However, Python’s unique strengths, charms, and expressiveness can be hard to grasp, and there are hidden pitfalls that can easily trip you up.

This second edition of Effective Python will help you master a truly “Pythonic” approach to programming, harnessing Python’s full power to write exceptionally robust and well-performing code. Using the concise, scenario-driven style pioneered in Scott Meyers’ best-selling Effective C++, Brett Slatkin brings together 90 Python best practices, tips, and shortcuts, and explains them with realistic code examples so that you can embrace Python with confidence.

Drawing on years of experience building Python infrastructure at Google, Slatkin uncovers little-known quirks and idioms that powerfully impact code behavior and performance. You’ll understand the best way to accomplish key tasks so you can write code that’s easier to understand, maintain, and improve. In addition to even more advice, this new edition substantially revises all items from the first edition to reflect how best practices have evolved.

Key features include

  • 30 new actionable guidelines for all major areas of Python
  • Detailed explanations and examples of statements, expressions, and built-in types
  • Best practices for writing functions that clarify intention, promote reuse, and avoid bugs
  • Better techniques and idioms for using comprehensions and generator functions
  • Coverage of how to accurately express behaviors with classes and interfaces
  • Guidance on how to avoid pitfalls with metaclasses and dynamic attributes
  • More efficient and clear approaches to concurrency and parallelism
  • Solutions for optimizing and hardening to maximize performance and quality
  • Techniques and built-in modules that aid in debugging and testing
  • Tools and best practices for collaborative development

Effective Python will prepare growing programmers to make a big impact using Python.

商品描述(中文翻譯)

更新並擴充至 Python 3

開始使用 Python 開發程式非常容易,這也是為什麼這個語言如此受歡迎的原因。然而,Python 的獨特優勢、魅力和表達能力可能很難理解,且有一些隱藏的陷阱可能會讓你踩到。《Effective Python》第二版將幫助你掌握一種真正「Pythonic」的程式設計方法,充分利用 Python 的強大功能來撰寫出非常健壯且高效能的程式碼。作者 Brett Slatkin 採用了 Scott Meyers 在暢銷書《Effective C++》中開創的簡潔、以情境為導向的風格,結合了 90 個 Python 最佳實踐、技巧和捷徑,並通過實際的程式碼示例來解釋,讓你能夠自信地掌握 Python。

Slatkin 在 Google 建立 Python 基礎設施多年的經驗中,揭示了一些鮮為人知的怪癖和慣用法,這些對程式碼的行為和效能有著強大的影響。你將了解完成關鍵任務的最佳方法,以便撰寫更易於理解、維護和改進的程式碼。除了更多的建議外,這個新版還大幅修訂了第一版的所有內容,以反映最佳實踐的演變。

主要特點包括:

- 30 個針對 Python 所有主要領域的可行指南
- 針對語句、表達式和內建類型的詳細解釋和示例
- 撰寫函數的最佳實踐,以澄清意圖、促進重用並避免錯誤
- 更好的使用推導式和生成器函數的技巧和慣用法
- 如何準確表達類和介面行為的指導
- 避免使用元類和動態屬性時的陷阱
- 更高效和清晰的並行和平行處理方法
- 優化和加固的解決方案,以最大化性能和品質
- 幫助調試和測試的技術和內建模組
- 協作開發的工具和最佳實踐

《Effective Python》將幫助初學者以 Python 產生重大影響。