Review of Python One-liners
July 30, 2020
Review of “Python One-Liners”
By Ian Mizer
Link to book
This book is great for flexing in an interview or thinking of python in completely different ways. The gripes I have with it are minor and will mostly boil down to nitpicking and the books subject getting in the way of its readability. If you're ok with that then buy this book for every would be or current junior developer you know.
Ok, Are they gone? I think I got rid of all the people who will only look at the highlight sentences. So now I'm going to sit down and go through all the actual pieces of this book and explain my system. I rated this book on 3 main subjects.
Readability : How easy would it be for someone to sit down with this book and finish it quickly.
Accuracy : How accurate is the information being given? Could you write every single line of code in this book and have the books answers match the code you wrote. Normally this is a -1 out of 10 per major mistake and per 4 minor mistakes the book makes
Subject : Does this book do what it wants to do and is what it wants to do good? Bonus points for books that provide outside resources. If the outside resources expand on the subject matter of the book then even more bonus points.
Readability : 8 out of 10
This book personally took me 4 days to read. The first 80 pages are a dream to get through. Everything is quick and easy to understand and if you have some understanding of everything already being talked about within the book then you'll find the first 3 chapters easy. In fact when I first sat down with the book I thought I would be able to get through this book in 3 days reading 60 pages a day. Then I got to chapter 4.
This is where the machine learning topics came in. Doing machine learning in a single line of code is a bit of a slog. It isn't so much that the material is poorly written as it is that the topic is difficult to make easily readable. The author does what he/she can, but I believe that only an incredibly experienced writer who focuses completely on the readability of each sentence could conquer this problem. Bonus points for the attempt.
There are some pages of this book that refer to and use certain operators before explaining them. Like the star/asterisk, which the book mentions in two different ways and uses it in 3 ways. This usage will confuse some readers and cause them to stop and google what's going on in the code they're looking at. This will causes some slowdown in your reading
The author also falls into the most common pitfall of the entire Code writing industry : He/She uses variables instead of using words that describe those variables. This causes the obvious problems of making the material a little harder to read overall. It also causes a few problems where a variable name like “a” or “i” will be used and it will cause you to stop to check if you've lost your place on the page.
Example “In plain English,
you create a new array containing only those elements of the data array a
for which indexing array indices contains True values at the respective array positions. “
Using variables this way for text can have a jarring feeling as though you lost your place on the page. The important thing is : “Using variables makes text less readable than if you just use a descriptor for the variable you're referring to.” Something like “ListObject1” or “Absolute1” instead of “a” or “i”
Accuracy : 9/10
There are 4 pages in the whole book that I was able to find that had errors and 2 of those errors are easy to correct in your head without thinking about it. All of these errors are able to be seen by the reader and quickly worked out once you read through them. I would say this is almost as accurate as a technical book can actually be.
Subject : 10/10
The subject of writing all of your code in a single line is exactly what this book gets done. One-Liners as a subject itself is contentious. If you're going into a machine learning interview then writing all of your answers out as a single line will impress interviewers. If you can show testing for that line and write a well commented version of it within the same interview then you will impress the interviewer even more.
If you're going into a company that doesn't do machine learning or has a large code base that will need to be managed by the applicant then this will do well, but not impress anyone. One-Liners can never really hurt you in a code interview. The worst case scenario I've gathered is that this just might not be what the person you're interviewing with is looking for. It does improve your understanding of code as a whole, but use it based on who you're looking to work for.
+1 The website “pythononeliners.com” referenced by the author is great for expanding the book, improving on, and better explaining the pieces of the book you might not understand. The video series is currently up to 8 videos and the youtube channel itself has a wealth of python information. I would highly recommend checking it out yourself.
+1 The accompanying youtube channel is something that I will be adding to my regular watch list as it seems filled to the brim with an expansion on python knowledge.
There is a major expansion on python 1 liners on the Finxter website and youtube channel. The expansions are a must watch for anyone who enjoyed the book and it's concepts
Author: Ian Mizer
Categories: Book Review
Tags: Book Reviews