Effective Python: 90 Specific Ways to Write Better Python, Edition 2

· Addison-Wesley Professional
5 reviews

About this ebook

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.

Ratings and reviews

5 reviews
Mervyn Lee
April 18, 2020
There are a lot of great tips and best practices in the book. The examples are in iterative form, starting from non-Pythonic code and eventually converge into Pythonic code. The author also demonstrate to solve problem in Pythonic way when the use case or scope of the problem grows. The author includes some really advanced stuffs that you don't normally use or exposed to in your normal day to day usage, such as ways to optimise performance or CPU usage for video streaming across the Internet to handle scalability. Some of them took me a while to gasps the essence. There are quite a number of mistakes in code indentation which are crucial for understanding context and scope in Python. Few situational examples are not intuitive to understand and follow thoroughly. It is a book worth going through, to aware of the knowledge out there for you to leverage when you need them.
2 people found this review helpful
Did you find this helpful?
Rustam Khadipash
June 3, 2021
Exceptionally useful book!
Did you find this helpful?
Anil Das
June 13, 2021
Did you find this helpful?

About the author

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.

Rate this book

Tell us what you think.

Reading information

Smartphones and tablets
Install the Google Play Books app for Android and iPad/iPhone. It syncs automatically with your account and allows you to read online or offline wherever you are.
Laptops and computers
You can listen to audiobooks purchased on Google Play using your computer's web browser.
eReaders and other devices
To read on e-ink devices like Kobo eReaders, you'll need to download a file and transfer it to your device. Follow the detailed Help Center instructions to transfer the files to supported eReaders.