Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Better Python code: a guide for aspiring experts
Mertz D., Martelli A., Pearson, Hoboken, NJ, 2023. 288 pp. Type: Book (9780138320942)
Date Reviewed: Jan 23 2024

The Python programming language’s versatility and ease of learning has made it a popular choice in both industry and academia. This has also led to the production of many Python books and tutorials.

Better Python code by David Mertz is not another tutorial, but rather a complementary text that focuses on how to write better code. The richness of the Python language in terms of syntax and constructs offers several ways to implement the same code feature, for example, iterating over loops. The aim of the book is to show how to write “Pythonic” code, which means writing code that is more efficient, more readable, and easier to maintain.

Driven by his experience in writing Python code and reviewing other developers’ code, the author offers a long list of best practices in writing loops, selecting the right data structures, security, and so on. The book is suitable for both Python developers and Python language teachers. It is based on Python version 3.12, released in October 2023. Upon the release of future versions of Python, it is likely that most of the content will remain useful, with possible minor amendments to future editions of the book.

The book is divided into nine chapters, plus an appendix. The main chapters highlight the most common pitfalls when coding in Python and provide best practices. The appendix lists other Python topics that are not covered by the present publication but could be the subject of a similar study. It is also worth mentioning Tim Peters’s Zen of Python (https://peps.python.org/pep-0020/#the-zen-of-python).

In my opinion, the best way to get the most out of the book is to read it entirely and try the examples. The second step is to review your existing code and try to modify it according to the best practices discussed in the book. With time, and when writing new code, it will be easy to spot where the best practices can be applied.

I highly recommend Better Python code to any Python programmer. It is not only easy to read and easy to put into practice, but will also help to improve the quality of Python code. Educators should include the book in their Python course syllabi whenever possible, so students are trained to write Pythonic code from the beginning.

Reviewer:  Ghita Kouadri Review #: CR147693
Bookmark and Share
  Featured Reviewer  
 
Python (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Python": Date
Practical Python
Hetland M., APress, LP, 2002.  648, Type: Book (9781590590065)
Mar 28 2003
Python programming: an introduction to computer science
Zelle J., Franklin B, 2003. Type: Book (9781887902991)
Dec 2 2004
Foundations of Python network programming
Goerzen J., APress, LP, Berkeley, CA, 2004.  512, Type: Book (9781590593714)
Dec 26 2004
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy