Did you know: programmers convert coffe to code?

If you like my articles, support me with a small amount.

Buy me a coffee

Book review: Learn Python the Hard Way by Zed A. Shaw

I promised applefruity to give him a reply on the book “Learn Python The Hard Way” from Zed A. Shaw — and I thought it is a good opportunity to make it a blog-post.

And because the book helps you to learn Python the hard way I created a simple application — however not from the book itself but I made the book be an application.

As you can see on the comments of the initiator post it is not long ago when I was asked to reply on the book. If you’ve looked at the book or even read it you might know that reading and making all the exercises is not done in two weeks. It is a longer thing.

But I went through the book as fast as I can: skipping the coding and learning parts because I know Python already. But reading a book teaching you a programming language or programming concepts is always a good idea in my opinion because you can never learn out. As the Chinese proverb states (in this book and some other): Learning is like rowing upstream: not to advance is to drop back.

About the book

It is really the hard way to learn Python with this book. There are many repetitive and annoying tasks which I do not like — I do not like yak-shaving while programming but for other subjects (playing the bass or languages) it is not as bad.

So if you do not like weeks spent doing nothing just memorizing keywords of Python and truth-tables than this book is definitely not for you. Also if you are at least an intermediate (Python) programmer you can skip this book — it does not tell you anything more than you already know. If you are new to Python you can grasp the concepts in this language with what you already learned in other languages. For the rest there are other books and search engines on the internet.

The overall conception of the book is good, it is well-designed and gives the needed knowledge for each exercise — if the author does not show his laziness and adds the research as homework. But I really miss some of the Python easter eggs — but I guess it won’t be the hard way if

import this

would be shown to a beginner.

Learning by doing is a good thing however — so I can just recommend to take this book if you are new to Python and programming languages. But as I mentioned previously I could learn programming without memorizing keywords for weeks. If you have some simple tasks you will learn the needed keywords fast.

The Application

And because it is said that learning is by doing I decided to move the free available e-book to ePub format — so I’ve written a scraper-converter application which goes to the books website and scrapes the content. Currently in a primitive way (wood cutting would sound I think better) but if I have time I’m going to improve it.

For the scraping of the sites I use BeautifulSoup — the Python version of JSoup (which I will introduce in another article in the near future). It is really just

  • go to the website
  • get the Table of Contents
  • go through the ToC
    • get the content of the exercise (avoiding the Video and commercial parts)
  • export the whole thing to a big epub3 format e-book

I had some problems with it because the source where I had taken the information how to compose a epub 3 format e-book was quite confusing mixing version 2 and 3 together. Helpfully I’ve found an epub validator which showed me all my errors in the whole book. So it was a bit of trial-and-error development. And if you look at the code you can see some parts which cannot be handled easily so I had to manually modify them.

And the solution is really plain: no images, almost no style (only where it has been some in the web content and epub can handle it). And Appendix A (or its contents at least) is missing. So I plan to add the missing appendix, gather the images and include them. Eventually I’ll look at the style perhaps I can gather it and add it to the epub.

As a big picture I try to make this epub creator more flexible a bit to enable handling of other books than “Learn Python the Hard Way”, validate the result with the online validator (if it is possible) and make other export formats (mobi, pdf and co.). But for this I need time and a bit of money to compensate my time spent on this project. If you see fantasy in it, I would really appreciate some bucks from you at my Gratipay (formally known as Gittip) account.

The sources of this project are released under the GNU GPL v2. And this time it is not on GitHub but at BitBucket because I started it as a private repository and wanted to hide it for some time (until I have a halfway usable application). And another reason for BitBucket is that I have created the software with the copyright of my company (JaPy Szoftver) and I try to distinguish between my hobby projects and those for my company or other work related repositories.


Senior developer, consultant, author, mentor, apprentice. I love to share my knowledge and insights what I achieve through my daily work which is not trivial -- at least not for me.

Click Here to Leave a Comment Below 1 comments