Warehouse Stock Clearance Sale

Grab a bargain today!


Effective Python
By

Rating

Product Description
Product Details

Table of Contents

  • Chapter 1: Pythonic Thinking
  • Item 1: Know Which Version of Python You’re Using
  • Item 2: Follow the PEP 8 Style Guide
  • Item 3: Know the Differences Between bytes, str, and unicode
  • Item 4: Write Helper Functions Instead of Complex Expressions
  • Item 5: Know How to Slice Sequences
  • Item 6: Avoid Using start, end, and stride in a Single Slice
  • Item 7: Use List Comprehensions Instead of map and filter
  • Item 8: Avoid More Than Two Expressions in List Comprehensions
  • Item 9: Consider Generator Expressions for Large Comprehensions
  • Item 10: Prefer enumerate Over range
  • Item 11: Use zip to Process Iterators in Parallel
  • Item 12: Avoid else Blocks After for and while Loops
  • Item 13: Take Advantage of Each Block in try/except/else/finally
  •  
  • Chapter 2: Functions
  • Item 14: Prefer Exceptions to Returning None
  • Item 15: Know How Closures Interact with Variable Scope
  • Item 16: Consider Generators Instead of Returning Lists
  • Item 17: Be Defensive When Iterating Over Arguments
  • Item 18: Reduce Visual Noise with Variable Positional Arguments
  • Item 19: Provide Optional Behavior with Keyword Arguments
  • Item 20: Use None and Docstrings to Specify Dynamic Default Arguments
  • Item 21: Enforce Clarity with Keyword-Only Arguments
  •  
  • Chapter 3: Classes and Inheritance
  • Item 22: Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples
  • Item 23: Accept Functions for Simple Interfaces Instead of Classes
  • Item 24: Use @classmethod Polymorphism to Construct Objects Generically
  • Item 25: Initialize Parent Classes with super
  • Item 26: Use Multiple Inheritance Only for Mix-in Utility Classes
  • Item 27: Prefer Public Attributes Over Private Ones
  • Item 28: Inherit from collections.abc for Custom Container Types
  •  
  • Chapter 4: Metaclasses and Attributes
  • Item 29: Use Plain Attributes Instead of Get and Set Methods
  • Item 30: Consider @property Instead of Refactoring Attributes
  • Item 31: Use Descriptors for Reusable @property Methods
  • Item 32: Use __getattr__, __getattribute__, and __setattr__ for Lazy Attributes
  • Item 33: Validate Subclasses with Metaclasses 1
  • Item 34: Register Class Existence with Metaclasses
  • Item 35: Annotate Class Attributes with Metaclasses
  •  
  • Chapter 5: Concurrency and Parallelism
  • Item 36: Use subprocess to Manage Child Processes
  • Item 37: Use Threads for Blocking I/O, Avoid for Parallelism
  • Item 38: Use Lock to Prevent Data Races in Threads
  • Item 39: Use Queue to Coordinate Work Between Threads
  • Item 40: Consider Coroutines to Run Many Functions Concurrently
  • Item 41: Consider concurrent.futures for True Parallelism
  •  
  • Chapter 6: Built-in Modules
  • Item 42: Define Function Decorators with functools.wraps
  • Item 43: Consider contextlib and with Statements for Reusable try/finally Behavior
  • Item 44: Make pickle Reliable with copyreg
  • Item 45: Use datetime Instead of time for Local Clocks
  • Item 46: Use Built-in Algorithms and Data Structures
  • Item 47: Use decimal When Precision Is Paramount
  • Item 48: Know Where to Find Community-Built Modules
  •  
  • Chapter 7: Collaboration
  • Item 49: Write Docstrings for Every Function, Class, and Module
  • Item 50: Use Packages to Organize Modules and Provide Stable APIs
  • Item 51: Define a Root Exception to Insulate Callers from APIs
  • Item 52: Know How to Break Circular Dependencies
  • Item 53: Use Virtual Environments for Isolated and Reproducible Dependencies
  •  
  • Chapter 8: Production
  • Item 54: Consider Module-Scoped Code to Configure Deployment Environments
  • Item 55: Use repr Strings for Debugging Output
  • Item 56: Test Everything with unittest
  • Item 57: Consider Interactive Debugging with pdb
  • Item 58: Profile Before Optimizing
  • Item 59: Use tracemalloc to Understand Memory Usage and Leaks
  •  
  • Index

About the Author

Brett Slatkin, 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.

Reviews

"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

Ask a Question About this Product More...
 
Look for similar items by category
Home » Books » Computers » Programming » General
Home » Books » Computers » Programming » Python
This title is unavailable for purchase as none of our regular suppliers have stock available. If you are the publisher, author or distributor for this item, please visit this link.

Back to top