{"product_id":"effective-python-9780134034287","title":"Effective Python","description":"\u003cb\u003eBook Synopsis\u003c\/b\u003e\u003cbr\u003e\u003cp\u003e\u003cstrong\u003eBrett Slatkin,\u003c\/strong\u003e senior staff software engineer at Google, is engineering lead and co-founder of Google Consumer Surveys. He previously worked on Google App Engine's Python infrastructure, leveraged Python to manage Google's enormous server fleet, and used Python to implement Google's system for PubSubHubbub, a protocol he co-created. Slatkin holds a B.S. in computer engineering from Columbia University in the City of New York. He lives in San Francisco.\u003c\/p\u003e\u003cbr\u003e\u003cbr\u003e\u003cb\u003eTrade Review\u003c\/b\u003e\u003cbr\u003e\"I've been programming in Python for years and thought I knew it pretty well. Thanks to this treasure trove of tips and techniques, I realize there's so much more I could be doing with my Python code to make it faster (e.g., using built-in data structures), easier to read (e.g., enforcing keyword-only arguments), and much more Pythonic (e.g., using zip to iterate over lists in parallel).\" -Pamela Fox, educationeer, Khan Academy \"If I had this book when I first switched from Java to Python, it would have saved me many months of repeated code rewrites, which happened each time I realized I was doing particular things 'non-Pythonically.' This book collects the vast majority of basic Python 'must-knows' into one place, eliminating the need to stumble upon them one-by-one over the course of months or years. The scope of the book is impressive, starting with the importance of PEP8 as well as that of major Python idioms, then reaching through function, method and class design, effective standard library use, quality API design, testing, and performance measurement-this book really has it all. A fantastic introduction to what it really means to be a Python programmer for both the novice and the experienced developer.\" -Mike Bayer, creator of SQLAlchemy \"Effective Python will take your Python skills to the next level with clear guidelines for improving Python code style and function.\" -Leah Culver, developer advocate, Dropbox \"This book is an exceptionally great resource for seasoned developers in other languages who are looking to quickly pick up Python and move beyond the basic language constructs into more Pythonic code. The organization of the book is clear, concise, and easy to digest, and each item and chapter can stand on its own as a meditation on a particular topic. The book covers the breadth of language constructs in pure Python without confusing the reader with the complexities of the broader Python ecosystem. For more seasoned developers the book provides in-depth examples of language constructs they may not have previously encountered, and provides examples of less commonly used language features. It is clear that the author is exceptionally facile with Python, and he uses his professional experience to alert the reader to common subtle bugs and common failure modes. Furthermore, the book does an excellent job of pointing out subtleties between Python 2.X and Python 3.X and could serve as a refresher course as one transitions between variants of Python.\" -Katherine Scott, software lead, Tempo Automation \"This is a great book for both novice and experienced programmers. The code examples and explanations are well thought out and explained concisely and thoroughly.\" -C. Titus Brown, associate professor, UC Davis \"This is an immensely useful resource for advanced Python usage and building cleaner, more maintainable software. Anyone looking to take their Python skills to the next level would benefit from putting the book's advice into practice.\" -Wes McKinney, creator of pandas; author of Python for Data Analysis; and software engineer at Cloudera\u003cbr\u003e\u003cbr\u003e\u003cb\u003eTable of Contents\u003c\/b\u003e\u003cbr\u003e\u003cp\u003ePreface xiii\u003c\/p\u003e \u003cp\u003eAcknowledgments xvii\u003c\/p\u003e \u003cp\u003eAbout the Author xix\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 1: Pythonic Thinking 1\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 1: Know Which Version of Python You’re Using 1\u003c\/p\u003e \u003cp\u003eItem 2: Follow the PEP 8 Style Guide 2\u003c\/p\u003e \u003cp\u003eItem 3: Know the Differences Between bytes, str, and unicode 5\u003c\/p\u003e \u003cp\u003eItem 4: Write Helper Functions Instead of Complex Expressions 8\u003c\/p\u003e \u003cp\u003eItem 5: Know How to Slice Sequences 10\u003c\/p\u003e \u003cp\u003eItem 6: Avoid Using start, end, and stride in a Single Slice 13\u003c\/p\u003e \u003cp\u003eItem 7: Use List Comprehensions Instead of map and filter 15\u003c\/p\u003e \u003cp\u003eItem 8: Avoid More Than Two Expressions in List Comprehensions 16\u003c\/p\u003e \u003cp\u003eItem 9: Consider Generator Expressions for Large Comprehensions 18\u003c\/p\u003e \u003cp\u003eItem 10: Prefer enumerate Over range 20\u003c\/p\u003e \u003cp\u003eItem 11: Use zip to Process Iterators in Parallel 21\u003c\/p\u003e \u003cp\u003eItem 12: Avoid else Blocks After for and while Loops 23\u003c\/p\u003e \u003cp\u003eItem 13: Take Advantage of Each Block in try\/except\/else\/finally 26\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 2: Functions 29\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 14: Prefer Exceptions to Returning None 29\u003c\/p\u003e \u003cp\u003eItem 15: Know How Closures Interact with Variable Scope 31\u003c\/p\u003e \u003cp\u003eItem 16: Consider Generators Instead of Returning Lists 36\u003c\/p\u003e \u003cp\u003eItem 17: Be Defensive When Iterating Over Arguments 38\u003c\/p\u003e \u003cp\u003eItem 18: Reduce Visual Noise with Variable Positional Arguments 43\u003c\/p\u003e \u003cp\u003eItem 19: Provide Optional Behavior with Keyword Arguments 45\u003c\/p\u003e \u003cp\u003eItem 20: Use None and Docstrings to Specify Dynamic Default Arguments 48\u003c\/p\u003e \u003cp\u003eItem 21: Enforce Clarity with Keyword-Only Arguments 51\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 3: Classes and Inheritance 55\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 22: Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples 55\u003c\/p\u003e \u003cp\u003eItem 23: Accept Functions for Simple Interfaces Instead of Classes 61\u003c\/p\u003e \u003cp\u003eItem 24: Use @classmethod Polymorphism to Construct Objects Generically 64\u003c\/p\u003e \u003cp\u003eItem 25: Initialize Parent Classes with super 69\u003c\/p\u003e \u003cp\u003eItem 26: Use Multiple Inheritance Only for Mix-in Utility Classes 73\u003c\/p\u003e \u003cp\u003eItem 27: Prefer Public Attributes Over Private Ones 78\u003c\/p\u003e \u003cp\u003eItem 28: Inherit from collections.abc for Custom Container Types 83\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 4: Metaclasses and Attributes 87\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 29: Use Plain Attributes Instead of Get and Set Methods 87\u003c\/p\u003e \u003cp\u003eItem 30: Consider @property Instead of Refactoring Attributes 91\u003c\/p\u003e \u003cp\u003eItem 31: Use Descriptors for Reusable @property Methods 95\u003c\/p\u003e \u003cp\u003eItem 32: Use __getattr__, __getattribute__, and __setattr__ for Lazy Attributes 100\u003c\/p\u003e \u003cp\u003eItem 33: Validate Subclasses with Metaclasses 105\u003c\/p\u003e \u003cp\u003eItem 34: Register Class Existence with Metaclasses 108\u003c\/p\u003e \u003cp\u003eItem 35: Annotate Class Attributes with Metaclasses 112\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 5: Concurrency and Parallelism 117\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 36: Use subprocess to Manage Child Processes 118\u003c\/p\u003e \u003cp\u003eItem 37: Use Threads for Blocking I\/O, Avoid for Parallelism 122\u003c\/p\u003e \u003cp\u003eItem 38: Use Lock to Prevent Data Races in Threads 126\u003c\/p\u003e \u003cp\u003eItem 39: Use Queue to Coordinate Work Between Threads 129\u003c\/p\u003e \u003cp\u003eItem 40: Consider Coroutines to Run Many Functions Concurrently 136\u003c\/p\u003e \u003cp\u003eItem 41: Consider concurrent.futures for True Parallelism 145\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 6: Built-in Modules 151\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 42: Define Function Decorators with functools.wraps 151\u003c\/p\u003e \u003cp\u003eItem 43: Consider contextlib and with Statements for Reusable try\/finally Behavior 153\u003c\/p\u003e \u003cp\u003eItem 44: Make pickle Reliable with copyreg 157\u003c\/p\u003e \u003cp\u003eItem 45: Use datetime Instead of time for Local Clocks 162\u003c\/p\u003e \u003cp\u003eItem 46: Use Built-in Algorithms and Data Structures 166\u003c\/p\u003e \u003cp\u003eItem 47: Use decimal When Precision Is Paramount 171\u003c\/p\u003e \u003cp\u003eItem 48: Know Where to Find Community-Built Modules 173\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 7: Collaboration 175\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 49: Write Docstrings for Every Function, Class, and Module 175\u003c\/p\u003e \u003cp\u003eItem 50: Use Packages to Organize Modules and Provide Stable APIs 179\u003c\/p\u003e \u003cp\u003eItem 51: Define a Root Exception to Insulate Callers from APIs 184\u003c\/p\u003e \u003cp\u003eItem 52: Know How to Break Circular Dependencies 187\u003c\/p\u003e \u003cp\u003eItem 53: Use Virtual Environments for Isolated and\u003c\/p\u003e \u003cp\u003eReproducible Dependencies 192\u003c\/p\u003e \u003cp\u003e\u003cstrong\u003eChapter 8: Production 199\u003c\/strong\u003e\u003c\/p\u003e \u003cp\u003eItem 54: Consider Module-Scoped Code to Configure Deployment Environments 199\u003c\/p\u003e \u003cp\u003eItem 55: Use repr Strings for Debugging Output 202\u003c\/p\u003e \u003cp\u003eItem 56: Test Everything with unittest 204\u003c\/p\u003e \u003cp\u003eItem 57: Consider Interactive Debugging with pdb 208\u003c\/p\u003e \u003cp\u003eItem 58: Profile Before Optimizing 209\u003c\/p\u003e \u003cp\u003eItem 59: Use tracemalloc to Understand Memory Usage and Leaks 214\u003c\/p\u003e \u003cp\u003eIndex 217\u003c\/p\u003e","brand":"Pearson Education","offers":[{"title":"Default Title","offer_id":55917740261719,"sku":"9780134034287","price":26.54,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0817\/1739\/5799\/files\/9780134034287.jpg?v=1794960957","url":"https:\/\/bookcurl.com\/products\/effective-python-9780134034287","provider":"Book Curl","version":"1.0","type":"link"}