Book Review: Murach’s Python Programming
Book Review: Murach’s Python Programming
Mike Driscoll reviews ''Murach's Python Programming'' and shares his thoughts on the book, including what it does well, its shortfalls, and who could benefit from it.
Join the DZone community and get the full member experience.Join For Free
I review books for the i-programmer website from time to time and they recently gave me a copy of Murach’s Python Programming by Michael Urban and Joel Murach. This book is long at almost 600 pages and it’s pretty expensive for the paperback. For those of you with short attention spans, I give you the Quick Review. For those who would like something a bit more in-depth, you will need to click through to see the rest.
Why I picked it up: In this case, because i-programming asked me to.
Why I finished it: Because this book is well-written and fairly interesting.
I’d give it to: Someone who wants to learn Python.
You can get a DRM eBook from Murach itself or just buy the paperback at an online store near you.
This book has 4 sections, 18 chapters and is 576 pages long.
Murach isn’t a publisher I was familiar with so I was surprised when I started reading their Python Programming book and found it to be of such high quality. The book is written by Michael Urban and Joel Murach. It is based on Python 3 and is an introductory book in nature. The book is split into 4 sections with a total of 18 chapters. Let’s spend some time going over the book, chapter-by-chapter.
The first section contains 8 chapters. Chapter 1 is a pretty basic introductory chapter and aims to show you the difference between Python and other languages. It also goes over how to use IDLE (Python’s included IDE) and run a “Hello, World” type program. The authors also explain how Python “compiles” the source code to byte code before running it. Finally, the chapter gives some tips on how to fix syntax and runtime errors.
Chapter 2 gives an introduction to coding in Python. You will learn about comments, using built-in functions, some of Python’s data types, arithmetic expressions, string concatenation and quite a few other topics. There are also two small programs that the authors implement at the end of the chapter using the concepts that you have learned so far.
Chapter 3 digs into control statements. In this case, we are talking about Python’s if/elif/else statements as well as how relational and logical operators work in Python. This chapter also covers Python’s looping structures (while and for loops), as well as break and continue statements. I didn’t see any mention of using the “else” statement with your loops, but I’m not sure I’ve ever seen that in a book before. Regardless, they update the programs from the previous chapter and demonstrate a couple of new ones using the new concepts in chapter 3.
Chapter 4 covers the definition and use of functions and modules. This is a fun littler chapter where you’ll learn about default values, as well as local and global variables. You will also get to create a module, document it, and learn how to import it. They also mention Python’s standard library and describe how to import modules from it. Finally, we learn how to plan out a program and then code one up.
Chapter 5 is where we learn about testing and debugging a program. You will learn about the common Python errors and some techniques for testing and debugging your software. As expected, they use IDLE’s debugger as well as print() statements to help in debugging one’s code. Interestingly we don’t learn about exception handling until chapter 8.
Chapter 6 is about Python’s lists and tuple data types. You will learn the basics of working with lists in this chapter and you will write three more programs throughout the chapter. Since tuples are immutable, their coverage is much less, but I think you learn more than enough to use them properly.
Chapter 7 is about how to use Python’s to work with files. In this chapter, you will learn how to open, create, read and write files. You will also learn about working with binary files and CSV files.
Chapter 8 is the exception handling chapter. It describes how exceptions work, how to handle single and multiple exceptions, and how to extract information from the exception object. You will also learn about the finally clause and how to raise an exception yourself. This chapter wraps up sections one.
Section 2 is described as covering “other concepts and skills” and is only 5 chapters long. I’ll keep this fairly brief:
In chapter 9, we learn about numbers in general. Here are some examples: floating point numbers, formatting numbers, using the locale module, rounding, and the decimal module.
Chapter 10 is all about strings. We will learn a bit about Unicode, slicing, indexes, splitting, and joining strings. We will also create or enhance 4 programs. The most complex is a Hangman game and is well worth reading about as it splits the functionality of the game into multiple modules.
For chapter 11, the topic is working with dates and times. You will learn the basics of Python’s time and datetime modules in this chapter and create a few programs using them too.
In chapter 12, we finally learn about one of Python’s most important data types: The dictionary (or dict). Here you will learn how to create a dictionary as well as get, set, add items, and delete items. There is also some information on converting a dict to a list and adding more complex values to your dictionaries. As usual, you will create some simple programs in this chapter.
This section wraps up in chapter 13 where we learn about recursion and algorithms. About half the chapter is devoted to learning about recursion works and how it works in Python. The rest covers some common algorithms, such as the factorial, the Fibonacci sequence and the Towers of Hanoi.
Section 3 is about Object Oriented Programming (OOP) in Python. It only has 3 chapters. Basically, these 3 chapters cover defining and using your classes, inheritance and the design aspect you need to use when doing object oriented programming. You will create more fun mini-programs in this chapter and learn lots of good information such as how polymorphism works, overriding methods, how to create custom exceptions, etc.
The last two chapters are in Section 4.
Chapter 17 is an introduction to databases and then dives into using Python’s SQLite module, sqlite3. It does not talk about any of the 3rd party modules you can use to connect to enterprise level databases, though. By the end of the chapter, you should know how to create a database as well as use SELECT statements and INSERT, UPDATE and DELETE statements in SQL.
The final chapter is chapter 18. It is an introduction to creating a GUI program using tkinter. The tkinter module has entire books based on it, so don’t expect this chapter to cover all that much. What you will learn is how two write a simple Future Value Calculator application, which is nice. But you won’t learn much more than that.
Overall I thought this book was well thought out and executed. The book uses a “paired pages” approach, so it has syntax, guidelines and examples on the right page and extra explanatory information on the left. I’m sure this works well in book form, but in their eBook version, it is a bit awkward. In fact, I really can’t recommend the eBook that you get direct from Murach. It uses a DRM application called LockLizard Safeguard that you have to download. You will get a license file that you will need to run before you can open your book, which is in a .pdc format. The application currently only supports Windows and Mac, so for Linux, you are just plain out of luck. The application looks like Adobe’s Reader application, but it’s extremely limited. You cannot highlight or add comments. I used it in Windows and found that if you had the Bookmarks pane in focus, then you could only scroll in that. You would need to click back in the book pane to be able to scroll there.
Anyway besides the obnoxious eBook client, the book is actually quite good. I feel like it covered the topics well and included some items that you don’t always see in introductory Python books, such as the CSV, database and GUI examples. The rest of the book is pretty standard fair for a beginner’s book, but the text is clear and the examples are interesting. I really like that you get to write mini-programs in almost all of the chapters and that they almost always do something besides just printing out a string. I believe this is a worthy book for someone who wants to learn Python, but if you already know Python, then this book probably won’t have anything of interest for you.
Murach’s Python Programmingby Michael Urban and Joel Murach
Published at DZone with permission of Mike Driscoll, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.