|Learning Python with Raspberry Pi|
Author: Alex Bradbury and Ben Everard
Python 2 and 3 come ready to run on the Raspberry Pi - is this a good way to get started?
Raspberry Pi is a great, little, and very cheap, single-board computer. And for reasons that I can't quite fathom, people buy them to learn Python even though they have a perfectly good PC or laptop ready to do the same job in more comfort. However, if for any reason you don't want to use a PC or a Mac to learn Python, or you have a Raspberry Pi sitting doing nothing, then this looks like the book that you need.
However, apart from the getting started, Python on the Pi is just like Python on the PC - so you could more or less use any book on Python even if it doesn't have the Raspberry Pi in the title. If by any chance you are looking for a book that explores the Pi and its hardware using Python then this probably isn't the book for you as it doesn't actually focus much on the Pi.
It is intended as a book for the complete beginner. To quote the backjacket:
"Assuming no prior programming experience whatsoever,..."
Chapter 1 focuses on setting up the Pi and you also get a quick tour of Raspbian - the Pi's main flavour of Linux. If you are a complete beginner in terms of using the Pi then this isn't going to be enough to get you through all of the problems that usually arise when a Linux novice tries to get it to work in anything but the out of the box configuration. It also doesn't provide much guidance on how best to create your Python programs and it doesn't tell you anything much about using IDLE, which is the way most users solve the problem by default.
Chapter 2 provides a quick introduction to Python. It is more like a rapid overview of a simple program and we are introduced to loops, conditionals, functions, variables and the kitchen sink. This is an approach that will work for the bright beginner and the experienced programmer, but I don't think it will do much for the complete beginner. If you find it tough going skip to the next chapter.
Chapter 3 attempts to introduce the basics of Python and programming. It proceeds at a fast pace but it doesn't have much logic about what to introduce and in what order. You are told about how variables work, using strings, boolean values and then straight on to dictionaries and sets. Then control structures are introduced - loops, nested loops, if statements and exceptions. The chapter then goes on to functions and object-oriented programming. There is also a lot of code taking up a lot of space that could have been devoted to explaining things. There is a lot to take in 26 pages and you will have to work quite hard.
The next chapter drops the pretense that this is a book for the beginner and jumps straight way to graphics using Qt. Again the pace is quite fast and before the chapter is up you are creating a web browser. Chapter 5 moves on to creating a game using PyGame - fun but not simple. Chapter 6 takes it all a step further with 3D graphics using OpenGL - this is just silly in a beginner's book. You get to create a spinning cube and that's about all before the chapter points you in the direction of a complete book on the subject. At best this is a taster for OpenGL and the space could have better been devoted to explaining some simpler material.
Chapter 7 changes the topic to look at networking - it starts with using raw sockets and then moves into building a dynamic website with Tornado. Then there's another switch in direction with Chapter 8 devoted to Minecraft programming;
Next Chapter 9 deals with multimedia - sound with pyAudio and vision with the USB cameras and OpenCV. The Pi's own camera module is introduced at the end of the chapter.
Chapter 10 shows how to use Python as a scripting language for Linux and the penultimate chapter is about hardware. The hardware chapter is particularly disappointing. After spending a lot of space on soldering irons, and wire cutters it shows how to flash an LED and then dives off into expansion boards that you can buy.
The book closes with a look at testing and debugging and, rather than dealing with the simple sorts of things that beginners might find useful, it spends most of its resources on explaining unit testing.
This is not a beginner's book unless the beginner is a quick study. It covers too much ground in too few pages. If you can already program in another language then you might get something out of this book, but it still isn't the best, either on the Pi or on Python.
|Last Updated ( Friday, 04 July 2014 )|