Learn Python the Hard Way, Lessons 1-16

Being nominally familiar with Python, these first lessons went by in a breeze. The biggest hiccup (if you can call it that) was going through the Command Line Crash Course, also written by Zed Shaw (the gent who wrote LPTHW). It was enormously helpful but took me approximately a week to get to the level of knowledge that I wanted. I did not finish it as I was very impatient to get back to lovey-woo-woo python, but my facility with the command line is prrrrobably as good as I’ll need it for the time being.

Several lessons went by per sitting, working things out with very satisfactory comprehension, until I got to Lesson 13! Lessons 13, 14, 15, and 16 have all begun to tax me much more than previous lessons, which is to be expected.

It’s odd, I can do all kinds of looping & sub-looping and data structures (with some effort) in Python 3.3, but in 2.7 my knowledge is developing completely laterally to that kind of capability. What that really means, at least to me, is that I am actually gaining new knowledge rather than just learning the formatting for while loops with 2.7’s idiosyncrasies and moving on. It is great.

One complaint that I have heard regarding Mr Shaw’s tone is that he is a bit short and a bit arrogant in that way that programmers are known to be. If this description is too vague for you, then you fortunately have not been over-exposed to this kind of attitude. I am a bit refreshed by his tone, however, because I find that he is right, and learning from someone with that kind of confidence in what he or she is teaching is totally instrumental in my absorption of the material, personally. Besides, I like a little sass, and I like a little old-school-style coding education.

Ok! Enough prelude! At this time, I’m at lesson 17, so let’s move on to that! “Next entry, please!” is what I know you are saying!

Advertisement

3 thoughts on “Learn Python the Hard Way, Lessons 1-16

  1. If ARGV is anything like it is in other languages, it’s not so much about passing files from the command line to the program, it’s about passing command line arguments to the program (hence the “ARG” in ARGV). Whatever you type on the command line after the name of your program will be accessible via ARGV.

    • So if it’s not just files, what, we could throw a CAT on the end or something and… display the contents of the file? I see what you’re pointing out and it seems to illustrate perfectly how powerful the command line really is, but can you give an example of an additional command, rather than file, that would be useful? It does make sense in the context of Linux, but I don’t see what you’d use it for, just yet.

      • ARGV is just whatever was typed on the command line. If you want to pass in a file to your program, usually that’s done just by putting the file’s name there, and then the program can find that file and do whatever with it.

        You probably wouldn’t want to put the actual contents of a file on your command line, since there are usually limits on the length of a command line (though they’re big these days). Let your program handle opening and reading the file.

        Some programs do something different, but similar: pipelining. Look that up. It’s a bit closer to actually putting the contents of a file on the command line, but it’s not even that really. A discussion for another time..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s