Brett Slatkin is a principal software engineer at Google. He is the technical co-founder of Google Surveys, the co-creator of the PubSubHubbub protocol, and he launched Google’s first cloud computing product (App Engine). Fourteen years ago, he cut his teeth using Python to manage Google’s enormous fleet of servers. Outside of his day job, he likes to play piano and surf (both poorly). He also enjoys writing about programming-related topics on his personal website (https://onebigfluke.com). He earned his B.S. in computer engineering from Columbia University in the City of New York. He lives in San Francisco.
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.
發表於2025-01-11
Effective Python: 2nd Edition 2025 pdf epub mobi 電子書 下載
Item 24: Use @classmethod polymorphism to construct object generically 可以處理如何動態構建模型的問題。 Item 25: Use `super(__class__, self).__init__()` when inheriting Item 29: use plain attributes instead of getter and setters. Shortingcoming of @property...
評分Item 24: Use @classmethod polymorphism to construct object generically 可以處理如何動態構建模型的問題。 Item 25: Use `super(__class__, self).__init__()` when inheriting Item 29: use plain attributes instead of getter and setters. Shortingcoming of @property...
評分其他部分(並發, 模塊, 部署)大部分都瞭解, 更願意看一下 OOP 的想法. 在這裏稍微記一下. 盡量使用異常來錶示特殊情況, 而不要 return None 現在看, 有兩種比較棘手的情況: (1) 有時候一個方法裏涉及數個含網絡請求(which means 必須考慮失敗)的調用, 會寫成這樣: def call0(): ...
評分我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看過瞭 我看...
評分Item 24: Use @classmethod polymorphism to construct object generically 可以處理如何動態構建模型的問題。 Item 25: Use `super(__class__, self).__init__()` when inheriting Item 29: use plain attributes instead of getter and setters. Shortingcoming of @property...
圖書標籤: Python 計算機 英文原版 編程語言 編程 編程 程序設計
新版拋棄瞭Python 2,介紹瞭一些Python 3的新特性(Python 3.8);這本書比較好的地方是,每個知識點舉例比較詳細,並且通過對比告訴你為什麼要這麼做。
評分這本書除瞭第六章的metaclass以外對於新手還是比較友好的,每節末尾的小總結很不錯,可以快速迴顧小節內容。 另外,作者在講某個概念的時候,往往會從問題開始,先給齣初步的解決方案,然後再慢慢改進,最後提齣關鍵的概念,比較循序漸進。 幾個之前不知道的技巧:enumerate,F-string,generator & itertool,decoration,classmethod,decorator & metaclass,ThreadPoolExecutor,try/except/else/finally, Cython,unittest. 不足的是作者沒有去和其他語言比較,或者去討論Python核心的一些東西,比如everything is an object等等。
評分增加瞭一些python3.8的新特性比如walrus operator,第六章metaclass略難
評分這本書除瞭第六章的metaclass以外對於新手還是比較友好的,每節末尾的小總結很不錯,可以快速迴顧小節內容。 另外,作者在講某個概念的時候,往往會從問題開始,先給齣初步的解決方案,然後再慢慢改進,最後提齣關鍵的概念,比較循序漸進。 幾個之前不知道的技巧:enumerate,F-string,generator & itertool,decoration,classmethod,decorator & metaclass,ThreadPoolExecutor,try/except/else/finally, Cython,unittest. 不足的是作者沒有去和其他語言比較,或者去討論Python核心的一些東西,比如everything is an object等等。
評分這本書除瞭第六章的metaclass以外對於新手還是比較友好的,每節末尾的小總結很不錯,可以快速迴顧小節內容。 另外,作者在講某個概念的時候,往往會從問題開始,先給齣初步的解決方案,然後再慢慢改進,最後提齣關鍵的概念,比較循序漸進。 幾個之前不知道的技巧:enumerate,F-string,generator & itertool,decoration,classmethod,decorator & metaclass,ThreadPoolExecutor,try/except/else/finally, Cython,unittest. 不足的是作者沒有去和其他語言比較,或者去討論Python核心的一些東西,比如everything is an object等等。
Effective Python: 2nd Edition 2025 pdf epub mobi 電子書 下載