Effective Python, 2nd Ed

Author: Brett Slatkin
Publisher: Addison-Wesley Professional
Pages: 480
ISBN: 978-0134853987
Print: 0134853989
Kindle: B07ZG18BH3
Audience: Python developers
Rating: 5
Reviewer: Mike James
Better Python - sounds like a fun read.

Python is a surprising language in the sense that you can be writing it in one way for years and then suddenly notice that doing it a different way is better. Python tries to provide one obvious way of doing everything but the way that you spot isn't always the best. This book is a collection of 90 specific recommendations for using Python better. Most of them are "small" in the sense that they are not architectural or design-focused, but small code snippets that demonstrate a better way to express an idea. You don't have to read the book from end-to-end or in one sitting. It is  ideal to dip into when you have time or have a problem. Although the book doesn't actually solve problems for you, it simply suggests better ways of doing things.  

 

Chapter 1 is titled Pythonic Thinking and I have to admit that I've never really thought the there was such a thing, despite having read PEP8 and countless other articles suggesting that there is  - you are either concerned with writing good code or you are not. The topics covered are very basic and really are just ones that don't fit anywhere else particularly.

Chapter 2 is about Lists and Dictonaries and these are topics that there is plenty of scope for finding alternative ways of doing things. I'm not sure I agree with all the recommendations but then you don't have to. Reading the justifications focuses the mind on what is good and what is not - you can then make up your own mind. In this case I think using a stride in a slice is perfectly acceptable.

Chapter 3, Functions also has some items I'm not in 100% agreement with such as don't unpack more than three variables and raise exceptions rather than return None. It is still a good and enjoyable discussion however.

Chapter 4 is about Comprehensions and Generators which are rich areas for exploration and innovation. Chapter 5 is about Classes and Interfaces and again I found things to disagree with and there is nothing much about multiple inheritance, which is something that marks Python out from other languages. Chapter 6 dives into the esoteric area of Metaclasses and Attributes. Esoteric it may be but this deals with down to earth stuff like getters and setters. Chapter 7 deals with the difficult area of Concurrency and Parallelism, something not often covered in Python books. Chapter 8 is a collection of topics loosely to do with Performance and Robustness and Chapter 9 is a similar collection on Testing and Debugging, not using any particular IDE.

The final chapter, titled Collaboration, is the most dispensable of the set, but even here there are some nice items. I don't agree with the use of type hints as an alternative to Docstrings, but again it's an opnion.

If you are Python enthusiast this is a great book to read. It is fun, absorbing and you will learn things. However, it is difficult to say exactly what you will learn. The 90 items are too many to keep in your head as you work and at best they might nudge you in the right direction when polishing code. The problem is that there is no grand overall principle to be absorbed here and no single skill - it is a collection of items that show you a way to do something and then an alternative way with an argument for why it is better. You can read this and have fun thinking about whether it is really better, or even how you could do it even better.

I can't promise that reading this will make you a better Python programmer, but it can't make you worse and you will, assuming you really do like Python and programming, have fun reading it. I suppose you could say it's as much fun as you can have without actually programming...

Recommended.

 

 

  • Mike James is the author of Programmer's Python: Everything is an Object published by I/O Press as part of the  I Programmer Library. With the subtitle "Something Completely Different" this is for those who want to understand the deeper logic in the approach that Python 3 takes to classes and objects.

 

<ASIN:1871962587>

<ASIN:B07S1K8KLW>

 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook or Linkedin.

Banner


Regular Expressions: Pocket Primer

Author: Oswald Campesato
Publisher: Mercury Learning & Information
Date: July 2018
Pages: 190
ISBN: 978-1683922278
Print: 1683922271
Kindle: B07FK4NHWQ
Audience: Those who want to understand regexes
Rating: 3
Reviewer: Alex Armstrong
Regular expressions are tough to remember so a pocket primer sounds [ ... ]



Programming Essentials Using Java

Author: William McAllister and S. Jane Fritz
Publisher: Mercury
Pages: 540
ISBN: 978-1683920373
Print: 1683920376
Kindle: B06WWFW2HB
Audience: Would-be Java programmers
Rating: 3
Reviewer: Alex Armstrong
It's not too late to learn Java!


More Reviews

 

Last Updated ( Tuesday, 18 February 2020 )