Introduction:
Python is a well-designed language. If you have not already tried it, I would highly recommend it. I have been reading a lot of books related to python. “Pythonic Programming” has been on my list to read and I finally got a chance to read it.
In this book review, I’ll be sharing my thoughts on “Pythonic Programming” by Dmitry Zinoviev.
Summary of the book:
“Pythonic Programming” is a comprehensive guide to writing Python code that is readable, efficient, and maintainable. The book covers wide range of topics, including Python syntax, tips, and performance optimization.
“Pythonic Programming” is structured into five sections with numbered tips which contain brief explanations about a particular tip. Each tip contains tidbits about particular python syntax e.g. single tuple. This book contains of a total of 100 tips which is great. This book attempts to uncover some of the best practices in python however failed to do.
In nutshell, this book is not very good in structure and content. Although I really this kind of book where the author writes “Traps” of languages. I wish more writers can write the same kind of book for other programming languages. Knowing “traps” in the language is a very huge advantage when developing in the real world.
Analysis:
This book attempts to write better python idiomatically but it fails to do so. It was a disappointing reading however there are some good tips and takeways:
General
- Tip 7 : Self-Document Your Code
- Tip 12 : Avoid “Magic” Values
- Tip 12 : Enumerate Your Constants
- Tip 20 : Embrace Comprehensions
- Tip 22 : Find the “Missing” Switch
- Tip 27 : Discover All Characters in One Place
Data Types
- Tip 38 : Treat Your Code as a Module
- Tip 42 : Count with defaultdict
Functions
- Tip 51 : Return Consistently
- Tip 53 : Return Many Values
- Tip 54 : Understand Optional and Keyword Parameters
Performance
- Tip 61 : Time It
Safety
- Tip 80 : Let Python Close Your Files
- Tip 83 : Use Properties
Conclusion:
Overall this book does not offer much, however you can read it once if you have some time.
Resources:
https://www.amazon.com/dp/168050861X?ref_=cm_sw_r_cp_ud_sem_74JJD732MCSQEMZR5PYC