No Starch Press recently sent me a book called Python Playground: Geeky Projects for the Curious Programmer by Mahesh Venkitachalam to review. I don’t normally get books from that publisher so I wasn’t sure what to expect, but the book is quite good. But I won’t provide any spoilers here as we have a quick review to do!
- Why I picked it up: I got it for free, but the description of the book made me want to get it too.
- Why I finished it: It’s very well written and the projects are definitely geeky and fun.
- I’d give it to: A programmer who is also a math nerd or who just wants ideas for a new, fun project.
You can get an eBook (PDF, EPUB or MOBI) version or a softcover.
The book is split up into 5 parts, 14 chapters + 3 appendices and clocks in at 330 pages.
Python Playground is a very interesting book. It has a lot of fun little projects to learn about. The writing is engaging and the code is easy to follow most of the time. You will probably get the most out of this book is you happen to enjoy math as a lot of the projects use numpy and various equations or algorithms to make them work. This is not a beginner’s book in other words. Let’s go over what the book covers.
Part one only has two chapters in it, but they are considered a warm up for what’s to come. Chapter one starts off with learning how to parse iTunes playlists (or plists). I had forgotten that Python had its own plist parser library built in, so that was kind of fun to learn about. In chapter two, we learn how to use Python’s turtle library to create spirographs. I thought this chapter was fun, although the example behaved a bit oddly on my dual monitor setup. The idea is super cool and well worth learning about.
Chapter three kicks off part two by going into Conway’s Game of Life. Basically you’re creating a basic simulator of life. Next up is chapter four in which we learn how to create musical overtones with the Karplus-Strong Algorithm. You’ll be using numpy, matplotlib and pygame for this chapter. The author does a really good job explaining how the algorithms work, so you shouldn’t get lost (or not very lost anyway). Chapter five ends part two with another simulator. In this one we learn how to simulate a flock of birds using the so-called Boids model. I found this chapter to be very interesting.
Part three is all about working with images. Thus in chapter six, we learn how to use Python to create ASCII art from a regular image. This was a really fun chapter. It was just really interesting to see how it worked. Then in chapter seven, we learn how to create photomosaics, which is where you take hundreds of various photos to recreate another one. You can see a few examples here. The last chapter of the section talks about creating autostereograms. The only reason I didn’t enjoy this chapter as much as the last two is that I had a hard time seeing the hidden 3D images in the autostereograms, so your mileage may vary with this one.
In part four we learn about 3D. So in chapter nine, we learn how to draw 3D objects using OpenGL in Python. Chapter ten digs into particle systems, which are used for animating fire, smoke and hair. This chapter builds on the last by continuing its use of PyOpenGL along with numpy. In chapter eleven, we learn how to do volume rendering with Python. Think of 2D images that show cross sections of a 3D volume (i.e. MRI or CT scans do this). This chapter also uses PyOpenGL and numpy.
Finally we get to part five which covers hardware hacking. Chapter twelve gives us an introduction to the Arduino and the basics of interacting with the Arduino using Python. In chapter thirteen, you get to create a “laser audio display” using your Arduino and Python. The last chapter of the book details how to create a raspberry-pi based weather monitor using Python.
The last part of the book are the three appendices. Appendix A just talks about installation procedures for Python and the various packages used in the book. Appendix B goes over the basics of practical electronics (terminology, components, tools, etc). Finally, Appendix C is Raspberry Pi tips and tricks.
Overall, I really enjoyed this book. The math can be a bit hard to follow at times, but the author is quite good at explaining what it does and why, so I didn’t usually get too bogged down by that. The projects were all very interesting and I was always intrigued to see how the author would use Python to make the magic happen. I would happily recommend this book to people looking for something a little different to read, but I’d also have to warn them that the author isn’t going to handhold them in learning Python. If you want to learn Python, there are many other books that you can check out. This one is for people who have already learned Python and want some ideas of what Python is capable of or for those who need to get their creative juices flowing.
Python Playground – Geeky Projects for the Curious Programmer
by Mahesh Venkitachalam
Other Book Reviews
- Intermediate Python by Muhammad Yasoob Ullah Khalid
- IPython Notebook Essentials by L. Felipe Martins
- Creating Apps in Kivy by Dusty Phillips
- Kivy – Interactive Applications in Python by Roberto Ulloa
- Instant Flask Web Development by Ron DuPlain
- Real Python by Fletcher Heisler
- Python 3 Object Oriented Programming by Dusty Phillips