173 comments

[ 1.9 ms ] story [ 209 ms ] thread
Whoa, that was quick.
He must have written a perl script that automatically writes a python book.
(comment deleted)
Yeah, with Markov processes, taking sample data from StackOverflow.
Interesting captcha system on the login page: http://learnpythonthehardway.com/login
That ASCII art CAPTCHA looks geeky, but it should be trivial to crack and is thus worthless if very many sites use it.
Or, just hit the little javascript button at the bottom that fills it in.

It's only there to keep bots out. It's not all that secure.

You mean script kiddie scanners.

document.getElementById('p').value='5544e312'

This isn't going to stop anyone who knows urllib.

Have you tried using urlib and urllib2? I think that alone prevents anyone from getting to the site. :-)

Seriously though, I'm going for simple and if there's a problem then I'll lock it down more completely.

I have written multiple crawlers for sites like facebook with them.

import urllib2;urllib2.urlopen("http://learnpythonthehardway.com/login).read()

Since you only want basic protection, you could avoid the visual captcha all together and have the "Fill out captcha" button auto-submit.

Be sure to read the end.
The message at the end is quite good. It is the same message he gave at the http://blog.cusec.net/2009/01/05/zed-shaw-the-acl-is-dead-cu... talk. I discovered Zed through the rant against Ruby's community (I had done a google search about ruby disadvantages or something like that and his post came up). He's grown up quite a bit.
No, not really. :-)
Well...I suppose my criteria is weak since I couldn't find your Judas Priest image on your site...so I assumed you've grown up (a little) :-P
(comment deleted)
Ohhhhh, I forgot some people equate "serious" with "grown up". Sorry, yeah, I'm totally grown up now that I took that one joke down. :-)
Still very incomplete. Goes from exercise 10 (by which point they've not done if statements) to exercise 27 (where they start learning about AND OR etc.

Tone/diction/sentence structure is a bit patronizing. I think Shaw was going for more basic than is required for most intelligent adults.

Have you never worked with someone and had the thought go through your head, "Sure, this person's intelligent... but can they write code?"

I'm not sure this book is a solution to that problem, but it certainly has a strong opinion.

A programming book has as much of a chance of turning you into a programmer than swimming classes of turning you into a fish.
I disagree with that analogy. It's true that some people just aren't ever going to be programmers, and no number of books will help that. On the other hand, some people have all of the correct mental attitudes, they just haven't been introduced to programming before.

I think a much more reasonable analogy is something like playing the harp. Most people see little point in learning, and many of those that try it won't have the aptitude/interest to actually become adept, but there are a few that will become masters.

> some people have all of the correct mental attitudes, they just haven't been introduced to programming before.

They already are programmers. They just don't know it yet

It may be semantics at this point, but 'being a programmer' isn't a certain mental attitude/aptitude such much as it requires a certain mental attitude/aptitude. Just having that attitude/aptitude doesn't 'make your a programmer.'
It seemed more geared towards kids to me. It seems like an attempt to bring back the way a lot of us learned, by buying books/magazines with code listings and typing them in. It's a decent idea. Anyone can do it and you really do learn something about writing code. Sadly, we stopped doing this when books started to come with disks. And then the internet... There is much less satisfaction with looking at source that is already typed and running it.

As an aside, I like that Zed is very opinionated.

Yep, that's exactly what it does. I wouldn't say it's geared toward kids, just anyone very new to programming. I'm writing it at about a 6-7 grade level so that the prose doesn't scare people away.
Yep, still a work in progress. Ex 27 is where they switch to learning logic, so I laid a marker there to work toward.

It's not really patronizing so much as "gentle" to non-programmers. I do however poke fun at programmers because non-programmers have some odd beliefs about coders being these gods that they aren't. By cracking little jokes are programmers I'm hoping to get them over this fear.

Oh hi there, forgot this is a small world we're in and you might actually read my comment. You're a good writer most of the time, however, I believe you're trying to use a certain style here, and that style may not be appropriate for this type of work if you are aiming at adults and children both; it is appropriate for a children's book though.

The patronizing part wasn't the non-programmer part and making fun of programmers. I actually loved the line about VI/Emacs. It was the overly simplified sentences. Let me dig the pdf out:

You can print things out with print and you can do math. The next step is to learn about variables. In programming a variable is nothing more than a name for something so you can use the name rather than the something as you code. Programmers use these variable names to make their code read more like English, and because programmers have a lousy ability to remember things. If they didn’t use good names for things in their software they’d get lost when they came back and tried to read their code again.

For instance in this section your actual sentences are very simple. Over and over you use these simple sentences. And you use an explicit "you". It gives the feel of a children's book (I don't know if you have kids, but if not, google for some of the books or ask a co-worker to borrow some). I think explicit "you" is fine, but the constant reassurance compounded with the sentence structure and explicit "you" feels patronizing.

Other examples:

You might not know it, but every time you put " (double-quotes) around a piece of text you’ve been making a string.

Most of these concepts will be exciting once you get them. You’ll struggle with them, like wrestling a squid, then one day snap you’ll understand it.

I know several people professionally who'd benefit from the book if you upped the "implicit respect" of the style a few notches. However, I'd be afraid to give it to a few of them out of fear of insulting them with the way some people will interpret the tone. I'm putting this out there in all earnestness.

Here are a couple books on two different styles which might be more applicable for the work. They are on actual explicit styles of writing, although the second pretends all writing should look like that.

Clear and Simple as the Truth by Thomas & Turner (Classic style).

Nonafflink: http://www.amazon.com/Clear-Simple-As-Truth-Writing/dp/06910...

Example of classic style:

When I was a boy, there was but one permanent ambition among my comrades in our village footnote [1. Hannibal, Missouri] on the west bank of the Mississippi River. That was, to be a steamboatman. We had transient ambitions of other sorts, but they were only transient. When a circus came and went, it left us all burning to become clowns; .... now and then we had a hope that if we lived and were good, God would permit us to be pirates. These ambitions faded out, each in its turn; but the ambition to be a steamboatman always remained. --Mark Twain

Style by Williams (Plain Style):

Nonafflink: http://www.amazon.com/Style-Clarity-Chicago-Writing-Publishi...

Example: After Peter the Great died, seven out of eight reigns of the Romanov line were plagued by turmoil over disputed succession to the throne. -- Williams edit to uncredited work on Russia

That's only patronizing if you take yourself too seriously. Otherwise it's just direct and simple. That makes it easier to read and makes sure that the prose doesn't make things seem more complex than they actually are.

Another way to put that is the complexity/simplicity of the prose attempts to match the complexity/simplicity of the exercise.

It's not me I'm worried about it coming off as patronizing to.

I'm worried about people I might recommend it to (and thereby seem patronizing myself). With the current style, I'd probably only recommend it to kids and a couple adults I know very very well.

Encouragement and assuming the user only knows what you have told them (which you do in a few places) are the things that don't come off as "adult literature". Hell, a couple teens I know would feel patronized by that, and teens definitely take themselves seriously. The short sentence structure is only the biggest of deal because of the other two facets. You could keep your grade 6 FKA score but ditch the other two parts of the style.

As the tone is now, I'm pretty sure they'd take me handing this to them worse than a X for dummies book.

Why can't you simply deride the language while praising the approach. Then the adult can believe you aren't being patronizing, maybe the book is, but the book is an effective way to learn. The teenagers can run through it in a short time (or read through it if they should be reading another book), and the adults will be fine. Have you heard how many adults say "oh I'm not very good with computers"? What's there to be good with?

Not that the book is worth derision, just as a tactic for those who take themselves too seriously.

As I said before: >It's not me I'm worried about it coming off as patronizing to.

I know Zed's history. I'm not going to have issues using the book. But random non-programmers don't. And those are the people I'd hand the book to. I've got a thicker skin than some of them, and wouldn't care about the tone of the tome even if he directly insulted me. But THEY would. That's the issue.

You aren't listening. He said to, "deride the language" and "praise the approach" to those you give the book to.

i.e. When you hand it to them, say, "the language is overly simple and patronizing, but his approach is a good way to learn." Then your (apparently) big-ego friends can mantain their air of superiority while reading the book, without being insulted.

Not that I agree that his language needs to be changed; on the contrary I think is is great. I would have loved such a gentle introduction, at any age.

They're not friends who I'd hand the book to.

They're certain people at companies I know and work with professionally who ask me "Hey gte910h, what's a great way to learn programming".

I'm known as respectful yet blunt. If I handed this to someone, they'd wonder if I was saying they came off as retarded or that I had no respect for them (or programming is much harder than it is for the type of tasks they want to do).

For people who work in relationship based businesses (many non-programming businesses are), what others think about you is very important. The idea I thought them incompetent would be a very bad thing.

Some of the people I'd hand a book that went through the typing approach without the coddling part would hear the book loud and clear and possibly not remember the message I could use to hand them the book: "Hey, this guy who tends to be a bit insulting to people in some of his writing wrote a book on programming. He acts like you're a dull 11 year old throughout the book. But hey, his method is good".

These aren't people with big egos, but I'd sure as come off as having one about my profession if I tossed this at them. Especially if they handed it off to a third person who I never met but had heard of me.

I'd just be more respectful and less helpful and not ever mention the problematic resource. It's not worth the risk I'd lose a client over it.

>You aren't listening. He said to, "deride the language" and "praise the approach" to those you give the book to.

It wasn't clear to me the poster was talking about those you give the book to. It just sounded to me like he wanted me to give props to Shaw for his approach while saying he wrote in a manner some would take offense to.

As to Zed Shaw, I think I've honestly put in more work on the book already than 99% of the people who love it unconditionally have. I've read it in it's entirety and given suggested changes. Editors and critics are very useful when writing books.

He doesn't need to change the style. If he changes the style, he can market it as a book for adults and children. If he keeps the style the same, he should market it as a book for 12 year olds. Then, when someone hands a copy, it says right there on the cover "Yo, this is for kids" and no one get's insulted as you can reveal "Hey, this is really good, in spite being for 12 year olds".

Holy... The output of this guy is as awesome as it is diverse. Way to go, Zed.
A nice quote from the last chapter:

Programming as a profession is only moderately interesting. It can be a good job, but if you want to make about the same money and be happier you could actually just go run a fast food joint. You are much better off using code as your secret weapon in another profession.

Well said, Zed. Very well said indeed.

This is very true -- if you're bad at it.
If you finish this book in its intended role, you will be bad at programming. That's an upgrade from the "completely unable to program" from before you started, but still, you'll be bad.

Instead of reading it as discouragement to become good at programming, I'd read it as encouragement that it can be used in the other things you are interested in. You don't have to be "a programmer". It's an important point.

Actually, you're right, but I wouldn't say "bad", I would say, you're ready to learn programming. Kind of like this gets you your programming brown belt.
Curious to know what other profession you might be considering going into where you can use your programming skills as your secret weapon.
Almost every profession, actually.
Like running a fast food restaurant? Or being a surgeon? Or a lawyer?
Definitively being a lawyer. Last week ago I hired a lawyer to look for some documentation for a house I was planning to buy, and about its owner.

He showed me I think more than 20 prints of web apps that he had visited, and on each one he sometimes typed his login, sometimes searched for a number, other times the name of the person, other with his state of residence. He could have reduced his typing to just one.

Also, if you don't believe this particular anecdote, I have dozens more. I've built web apps for law offices during 4 years. And when I left the company the TODO list for what I was working on was still huge. Absurdly huge. Software is never done.

Programming manages information and reduces repetitive computer tasks, and lots of professionals have this problem.

Now, should the owner of a fast food restaurant learn to code? Maybe not. Should he hire someone that knows how to code? Maybe not. Should he buy somekind of software to manage his operations? For sure.

But it's the same necessity: There's a problem, you can either solve it yourself or pay someone else to do it. And the problem is managing information and time.

(comment deleted)
Porn?
(comment deleted)
I can attest that programmers in porn can do incredibly well - Red Hat has a customer who purchased about 30K of Linux architecture training just to keep his brain active while he sat on the beach and occasionally reconfigured a server.
Finance, though it's obviously not a secret weapon anymore.
I'm having a hard time thinking of a profession (outside of menial physical labour) where you couldn't use programming skills to either make your job easier or to do it better.
I was deliberately matching the way I thought jrockway was using "bad". The journey of a thousand miles begins with a single step; this is in no way intended as criticism of your guide for the first step.
"Bad" is more of an attitude than anything you learn. You can be a good programmer before you ever know what Python is. And you can be a bad programmer even after writing 84 monad tutorials.
Well of course you'd be a bad programmer after just 84 monad tutorials. You need at least like 300, maybe 385 just to finally get it.

Sheesh, don't you know anything?

I still don't fully grok monads, but I think this is due to not having programmed in Haskell. Thus I conceptualize monads as a hole in an infinite plane. People (Haskell programmers) who deal with this infinite plane understand the hole to be an essential feature to move things from side to side. People who don't live with this plane wonder why the hell people think that a hole is so damn useful.
You don't need to really grok Haskell to grok monads. It's just that that's where they're most useful...

If you cared to hear my explanation, I'd tell you. (it involves a burrito...)

To grok monads, don't read a monad tutorial. Just write some code in haskell and monads will become clear very quickly.
What does skill have to do with anything? Pure programming is an answer in search of questions. Programming helps solve problems, but without knowledge of other fields, a programmer, no matter how good, has no idea what problems to attack.

Programmers know a whole lot about... programming. Some people therefore write development tools, IDEs, text editors, compilers, operating systems, and databases. This seems to me a relatively small niche, though. Commercial development tools often live and die by free and open-source competition.

Otherwise, without actual domain knowledge, a programmer becomes a tool for people who do possess this knowledge. Typical programming jobs suck because they boil down to pushing data from point A to point B, while transforming it in a way specified by someone else. For example, in the financial industry, a non-quant programmer is just a cog. Possibly a highly intelligent and competent cog, but still never the person who designed the underlying process. On the other hand, a quant with programming ability actually has a chance to do something original. Even traditional "computer sciencey" work is rarely just about programming. Computational biology, computational geometry, robotics — those are real fields, where programming helps solve problems.

I have to agree. The act of executing someone else's ideas with code is mundane and borderline annoying. It's the other things, the design and development that really gets your brain churning -- its also what gives you more value.
You are much better off using code as your secret weapon in another profession

In what fields is this true? What is the metric of "better off?" More money? More "respect?"

The metric in the sentence quoted is "interesting", and that the money is not the issue (as it is comparable to running a fast food joint.)
Still interested in examples.
Read the last page of the book, he enumerates many.
I think the point is around how coding can give you superior analytical skills that just blow people away because you can generate better insights.

Examples I've seen are people in marketing departments who can write a little python script and suddenly analyze hundreds of thousands of data points. Or someone who combines thousands of geo-targeted data points to better decide where to open chain x's new store.

Traditional companies are structured so that there's a "marketing" team and a "business intelligence" team of dba's-cum-statisticians. 90% of the time, if the marketing person doesn't ask the perfect question, they don't get a useful answer - and the BI person is on to their next task.

The coder can both ask the question, generate the data and then iterate based on the results of the output. Hugely powerful and can't be done by 90-95% of people in most companies.

Business consulting. They look at you like a wizard.
I have gotten the wizard treatment from SEOs I know, too. (Check this out: you can take one list of keywords from source A, and then another list of keywords from source B, and then figure out what are in A but not in B. It is magic!)

I saw another website once -- e-commerce in a niche y'all are uninterested in -- where, among numerous other problems, someone was about three lines of PHP away from adding six figures of revenue to the business, because the person who set up the website thought that title tags had to be the same sitewide because they didn't have time to rewrite each of the XY,000 pages individually.

In finance you would be ahead if you could tweak your models, in accounting you would be better off if you could write tools to automate your daily trivial accounting tasks, in marketing you would be able to impress your clients with a website that automatically shows live updates and spending from their campaigns. The list is endless if you have a little imagination.

And better off would either be more free time, more money or more status (however you define that). Pick one.

Working in a multinational finance company in an asset servicing role I can tell you this works up until the point when you are expected to do all of your day to day work in addition to helping out with any trivial task someone would like to automate.

Saying that, if I could install anything more pleasant than VBA I'd probably be happy.

Maybe it's more a question of managing your competencies and making sure you're paid accordingly. If you are expected to do something over and above normal duty it should be reflected in your paycheck.
Depends. Where I work, a lot of quants write prototypes in Excel, but then expect the "real programmers" to turn their prototype into something that consistently produces sane results.

I guess, in other words, our "day to day work" is "helping out with any trivial task someone would like to automate", though I personally wouldn't phrase it that way :)

Just to clarify slightly, I'm a tech guy doing a finance job (while I get round to looking for something else). My day to day work is processing millions of dollars worth of Corporate Actions for pension and investment funds worldwide. If my job description involved implementing solutions to business problems I'd be happy, but just now I do what I can while also having the same workload as other people in the same role.
Why can't you use MATLAB or R?
The problem typically comes when you are working in a role supporting someone else, i.e., traders.

Deploying software written in Matlab that other people can use is a nightmare.

Ah, that makes sense. Thanks.
Have you looked into VSTO? You still have to deal with bloat but at least you can write addins/automations for excel in C# and use Visual Studio...
Marketing: You can analyze and check your data 100-1000x faster than your co-workers. Hell, you can make entire vendors obsolete. Additionally: Making graphs without opening Excel shaves days of work off your year.

Biology: You can catalog and simplify your workflow by breaking things up and correctly keeping them all organized while doing things the fast way.

Author: You create smart searches, web spiders, pattern recognition (to capture your repetitive sections) and you learn formatting. Additionally, the text editor skills are very nice for some types of writing.

Automotive/Racing: Calculating gear ratios? Analyzing race data? Optimizing pit stops? Not everyone is a formula one racer.

Small Businesses: Automated Scheduling of Clerks/floorpeople, inventory managment, loss detection.

Fashion: Modeling (no pun intended) cloth usage by shape cuts, number of seams required, etc.

This is all great - if you're already a programmer and decide to pursue a different career, but still like programming.

Notice how weird that is? If you like programming, why are you doing something else? If you don't, why would you add programming to your duties as a race car driver? OK, if you really love both, do both.

Otherwise, you're just wasting time that you should be working on your actual job by piddling around in related programming projects. You're probably being mediocre at both instead of good at one.

> Notice how weird that is? If you like programming, why are you doing something else? If you don't, why would you add programming to your duties as a race car driver? OK, if you really love both, do both.

It's not weird to like more than one thing. It's also not weird to look at all of the areas you enjoy working in and make a combination of them work. This is what allows us to make a unique contribution.

>This is all great - if you're already a programmer and decide to pursue a different career, but still like programming.Notice how weird that is? If you like programming, why are you doing something else?

Because if you know even a little, it goes a long ways in other fields. And honestly, a huge number of programming jobs SUCK. I mean, it's a field specifically excepted from overtime laws!

>why would you add programming to your duties as a race car driver?

Because you want to race better? And it's not the driver who I know who does this (it's actually motorcycle racing), but instead some of the pit crew who does. Even hooked up a neato GPS thing for the racer.

>Otherwise, you're just wasting time that you should be working on your actual job by piddling around in related programming projects

Spoken like someone who's never worked outside of software development. If your job is "select the 10 best properties to turn over", you job could very well include "write software to help do that". If your job is "Make sure this data is sane", you can most likely write some software to help the process along, decrease repetition, and otherwise make you look awesome.

Also, from personal experience:

Teacher: create randomized, self-grading quizzes from a test bank of question templates; optimize the dickens out of your grading work flow; check for cheating on assignments

Interestingly there's a scandal running in Denmark right now where a big vendor has received around $10 million to create a system much like the one you're describing. The system was a year late, and now it doesn't work and constantly crashes due to overload. Embarrassing.
(comment deleted)
(comment deleted)
Maybe they aren't "better" jobs per-say, but System Administrators, Network Administrators, Security Auditors, Penetration Testers, etc, etc... can all benefit by knowing some basic programming. If you have to do it once, ok, if you might have to do it twice, write a script to do it for you.
I'm pretty sure that anybody who's actually _good_ at these jobs definitely knows more than a little programming. (Even if it is shell programming). The ones who don't are ones who use toolkits built by other people.
It is true in transportation. That's what my startup does.

More respect - oh yes.

More money - we think so. The early signs are good.

More low hanging fruit in terms of satisfaction or directly helping your users improve their life - most definitely!

BTW, " if you want to make about the same money and be happier you could actually just go run a fast food joint." is certainly not true in my case, and I suspect in many cases.

I do think "You are much better off using code as your secret weapon in another profession." has a lot of truth to it, although again, it depends on the individual.

Probably healthcare informational services.
Biology (and any science field). The ability to process massive amounts of data is key.
Bullshit. You can make gobs of money as a contract developer with very little risk.
Doesn't necessarily make you happier though...
Based on life experience and things I've read, I've found that once one reaches a level where basic needs are met and there's no need to worry about where the next (or the next three dozen) meal(s) come(s) from, money does very little to make people happy. Hell, as a student right now, my net worth is very, very negative, but I'm also very happy because every day I get to do exactly what I want to be doing, and my immediate future is pretty secure.

Money is really just a form of freedom. If people are free to do what they want, they will be happy; if not, they will be miserable.

I have had (like many people) quite a rollercoaster over the past few years, and after making more money than I needed, and then having the rug pulled out from under me, I remember telling my brother "I just can't wait to get back to an equilibrium" and once I got back to that point, I appreciated it so much more and came to understand that blowing any surplus income (or even worse, money we don't have) is the equivalent of flushing years of your life down the toilet. I love your perspective on money as a form of freedom and couldn't agree more.
I was refuting his assertion that running a fast food joint pays as well as programming. Not that making more money by programming will make you happier.
I guess it depends on what is meant by "running a fast food joint." If it's "running" it as the general manager, then I'm sure programming wins handily. If it means owning said fast food joint, then maybe not (though I don't have a good idea how much such a business nets its owners per year).
Most programmers aren't silicon valley hot shots working at the coolest companies. I have no trouble believeing our average programmer working your avereage dull programming job makes about the same as the general manager of a fast food joint.
Would you mind moderating your language?
(comment deleted)
From what I've read, Zed's goal is not to be exhaustive training for an existing professional developer, but a gentle introduction for the non programmer.

He's leveraging his experience from taking time off to go to music school.

http://sheddingbikes.com/posts/1272132621.html

Yep, that's correct. It's just a key to open the rusty lock.
It uses printing to teach strings, format chars, escape sequences, variables, and calling functions.

Glad to see my sneaky ways are working. :-)

(comment deleted)
I think introducing some mystery of programming would be nice. The draft is very linear and predictable. How about a random number generator (linear RNGs are easy to code)? Or a line-by-line chaotic ascii art generator (like Wolfram's CA's)? Or, some other way to combine some of the string stuff with the arithmetic stuff.

Also, I think python's + and * string operators are far cooler than the string escape sequences. A 6th or 7th grader would have mastered + and * for numbers, and the extension to strings might be interesting to them.

Think of how cool some of the examples in SICP are as an inspiration. Simple, powerful, surprising. Not just type this, get that.

The last page is nice, and insightful about the expanding future for using programming to advance another discipline. The bitterness at the end ("go to hell") was an off-taste.

Actually ascii art is in the works, but not yet. There will be a couple manual ones, but then the logic section will do more fun stuff. Remember, at the beginning the ready doesn't even know boolean logic, ifs, or looping yet.

If you have ideas, throw them into the proposed exercises wiki:

http://learnpythonthehardway.org/wiki?name=Proposed+Exercise...

I like the idea of this -- any chance for a Ruby spin-off?
Maybe by someone else? I think Zed is done with the Ruby camp. Although only he can really answer that.
I registered learncodethehardway.org in order to do similar books for other languages. I'd do a Ruby book, but probably after a C book.
Would you include Haskell in?
If Zed started off life as a slightly loose cannon coding rock star, I believe we've seen him evolve into something much more important with greater staying power. Here's hoping he stays excited and engaged in the Python community.
I was never a coding rock star. That's an image other projected on me along with "he's a Ruby guy", "he's a Python guy", "he only codes scripting languages", and many other bizarre myths.

But hey, like David Lee Roth said, "Who am I to fuck up a good myth?"

I think the ZSMFA thing was hilarious, but it went over most people's heads (sadly.)

Watching your vim-fu at the first RoR conf (which I don't expect you to remember,) I still long for a series of vim screencasts from you, going into things like custom vim scripts and how you integrate it into your workflow.

This looks like a good start for what may become a great resource. Like others have noted, the ending is well worth reading, pity it had to arise from such vitriol.
I said this on Twitter directly to Zed, but it bears mentioning here. This is a sweet introduction to both programming and Python. I started playing with Python a couple weeks ago and wrote a few small applications. One of my pythonista friends looked over my code and noted that I could have used string formatting instead of concatenating everything. None of the books and tutorials I'd skimmed mentioned the print formatting but this book explained it perfectly. Best of all, its succinct.

I'm sure there will be a ton of new exercises added to the book, and more topics to come, but this is a great start. Thanks Zed!

Glad it's working for you. As I work on the book, let me know if any exercise isn't making sense. Many times if that's happening there's something you're missing I need to include.
I'll be getting some free time in about 3 weeks and have been interested in picking up my python education again (after a very long hiatus). I've written some non-toy language tools in it and was impressed with the language, but the existing books I was learning from were too hard to keep referring back to and I've long since forgotten even basic syntax.

I'm following this book with a great deal of interest and plan on working through it completely. I'll let you know if I get any hangups.

This is awesome. I love this guy, really. Zed, I'm interested in knowing how did you evolve as a programmer? Do you've a degree in Computer Science? If no, how did you go about learning all the stuff that you know today? Totally OK, if you choose not to answer this one ;)

Non-native speaker, so sorry for bad English.

I have a business degree, MIS. CS was boring with no depth, but business let me study a ton of random things and focus on people and computing.

Other than that, I don't drink, so that gives me lots of extra money and free time. Like I just bought another guitar. Woot! G&L Comanche. Can't wait.

What the eff has that to do with the fact that you don't understand what it means to teach?
Are you familiar with the concept of devolving?
The restrictions on proposed exercises seem a bit extreme: http://learnpythonthehardway.com/wiki?name=Proposed+Exercise...

If a beginner can't learn OOP or use projects that span multiple files, are they really ready to learn Python the hard way?

Plus, I would disagree with the definition of "complex math". My college discrete math teacher (who was from Mexico) said that he learned everything he was teaching us in elementary school, so I don't think that just because you learned some math in college necessarily makes it complex.

Well, they can't quite code Python when they're done with this book. They could then move onto a book that teaches those concepts.

And if you think about it, there's no point in learning OOP before you've even learned basic logic, functions, and I/O. That's what I learned first (because there was no OOP when I was learning).

Finally, your professor and you are not who this book is meant for. The simple fact you think discrete math is alright for anyone but a CS major is proof of that. Not to be mean, but it is.

"The simple fact you think discrete math is alright for anyone but a CS major is proof of that."

Fair enough, but that doesn't make me wrong. There is a valid case to be made for teaching discrete math to people who aren't CS majors or even in college: http://www.artofproblemsolving.com/Resources/articles.php?pa...

In particular, the argument that discrete math is fun is the most compelling. Be honest, what did you enjoy the most: algebra, calculus, or discrete math? I'd argue that if you say algebra or calculus that you're the abnormal one. :-)

Calculus by far. I read this "Calculus Made Easy" by Silvanus P. Thompson and it's still to this day my inspiration for explaining complex technical topics to lay people. It's a fantastic book, and even if you know math you must read it if you want to understand how to teach complexity to others.
I'll check the book out, but I still say you're a freak. :-)
I've never heard of fossil before. There's a lot of noise around Git and Mercurial these days (I just recently transitioned to Mercurial from SVN), but fossil sounds like an interesting concept - and indeed, once I've got an SCM, the next thing I go looking for is some kind of bug tracking system to integrate it with. Nice!
This is wonderful. I've "been thinking" forever about trying to write a book to teach children (in particular) how to program in python. But among other problems, I had never come up with an approach that made sense. (That is, one that didn't start with something stupid like "data types".)

So, I really like the approach here, and I really like the tone.

Allow me to recommend "Hello World, Computer Programming for Kids"

http://www.manning.com/sande/

Full disclosure, I know the author, and helped out a bit with the book.

The output of Zed Shaw is unbelievable in terms of stuff he actually gets done and delivers. Maybe he should deliver a few GTD seminars :)
He'd just yell at you until you left the room and started doing something else.
From what I hear is online persona and real life persona term to be quite different.
No, it's just there's more abusive dicks online who need to be told off. :-)
Ugh... reading this later:

  s/term/tend/
  s/is/his/
Sometimes I'm not sure if Zed is a prima donna or just misunderstood. But, one thing is for certain. Zed definitely contributes to his respective communities. He contributes a lot. Probably more than most of us ever will.

Thank you Zed for your hard work and contributions.

I prefer Diva. It implies I have skill. :-)
Zedonna?
Oh, holy crap that's good. You may see me steal that.
on a related note, has anyone read through Thinking in Python?
if zed is indeed the anti-why, this will be his non-poignant guide
Zed's soothing guide to Python?
How is this better than python docs again? Seriously. It's not for beginners, it's not for intermediate, it's not for advanced users in its current form.

I remember when I was a kid (cue during the war...) we had to type in sheets of paper in order to play games, learned through modifying them, experimenting like in a sandbox. I don't remember if I saw something similar in the past 15 years or so. It doesn't even have to be a book, it would work as a sandbox type of environment. I think I saw one based on scheme, but I can't remember the name right now.

That's the feel I'm trying to capture, but in a more structured way so it's more generally effective. I learned that way too. Typed in a game where a Donkey had to dodge cars, all written in BASIC. Reams and reams of paper. Line by line.

But, to be honest I also had some original aptitude, so I got lucky that this worked out for me. Expecting other people to just "type in a load of code" probably won't work the same.

good luck, you'll need it! I remember that feeling since I typed in all of that code that I was a master of it, so I inherently started adding stuff into it, which made me go look up how to add stuff into it, pretty simple learning process. Not to mention "debugging" typos.
One common theme, at least for the programmers growing up in the 80s, was that all the BASICs had graphics support.

Like you, I didn't learn logic and control structures to print out tables of numbers, I learned it so I could make an object move on the screen and to draw pretty pictures. I learned all the print capabilities to make a pretty looking layout on the screen and to get some random information "just so".

The reason I say this is that I like the idea behind this text, a lot, for people who want to learn from nothing, but I don't think it will hold people's interest for that long. I keep wondering if they'll just burn out if you're doing nothing but printing out the textual results of logic puzzles.

I'm not asking for a video game, in fact, I'm not sure exactly what I'm asking for, but there's got to be a way to light a fire in someone's head the same way it lit in mine when I typed in "line 32,32 to 32,64" from the BASIC manual and a red line appeared on the screen... and I realized I could do anything on that screen with the right sequence of commands... anything.

(Well, I found out otherwise later... but that's how it felt)

(And yeah, I realize getting graphics set up in python sucks for rank beginners... part of the reason I'm not sure exactly what should be done...)

yeah, goal oriented teaching is where it's at IMO.

I still remember C64 and I typed in (I still remember it):

POKE 53280,0 : POKE 53281,0

and voila, black 1337 haxor screen like "big" computers had! Then curiosity kicked in and I learned what POKE was and what it does and what are those addresses etc.

Also one vital thing about my specific path is that I asked for a computer (my first one was ZX-80) when I read about some computer game (I think it was called valhalla or something) where there was this whole world you could explore and my first reaction was not "cool I'd like to explore it" but was more like "cool I can make my own world with this computer thing"!

nodebox is pretty good for graphics, python and beginners. only works on macs, though..

http://nodebox.net/code/index.php/Home

if you don't care about python, processing is a great way to teach programming with instant graphic feedback and is cross platform.

Yes, but before you did any of that you did printing. Admit it, the graphics came much later unless you started with logo. If you started with logo though, you probably don't consider that language your first programming language.

I just think that until there's a solid totally idiot proof way to do "write, run, fix" and get graphics you'll fail at this. It's this patter of writing out a file, running it, and fixing it that's missing really.

But, I also think making things fun for people is overrated. Too often we think that in order to teach we have to entertain. Problem is that makes people (kids and adults) who can't learn anything hard. Hard problems are not entertaining. They may be satisfying, but until you've slogged through solving a bunch of them they aren't really entertaining.

Anyway, I just don't think graphics and entertainment is where it's at. Making it possible to accomplish the exercises and feel like you learned something that gets you ready for fun and graphics is all I'm aiming for.

No, that actually wasn't the case -- although I can see why you'd think not. I typed in the graphics example from the BASIC manual[1] that gave you a blinky smily face and played with that. Ok, I went to printing and '10 print "hello" : goto 10' shortly after though... :-)

Fair enough about the rest.

I sort of wish I could look at the innards of that manual again to see how they structured it...

[1] http://www.amazon.com/Getting-Started-Extended-Color-Basic/d...

As a teacher I can attest that it's impossible to find decent programming "text books" for Python, PHP, etc for classroom work. Most of the books you see on the bookshelves at Great Big Book Chain may be great books for programming language autodidacts, but they don't get adopted in courses because they universally lack relevant exercises for newbie students.

As a result, instructor's have to create all of the questions and exercises for the course---he/she might as well work without a book. At MIT, the Intro to Programming Course (using Python), doesn't have a textbook because, say the instructors, there are no good textbooks for Python. If Zed can come up with well-paced and instructive questions (Little Schemer-style), he's got a winner.

BTW, If you plan to contribute questions to Zed's book, try to put yourself into a newbie state of total ignorant bliss. Remember that the ideas you take for granted and think of as "simple" are completely daunting to beginners. Pacing is everything.

The <title> element reflects the current page, which is a nice improvement over his other new sites <g>.
This is awesome, Zed. I would have loved this five years ago, the first time I tried (unsuccessfully) to teach myself programming. I actually tried to learn with emacs and SICP because I took advice from the "wrong" people.

The second time I tried to learn programming it was a lot easier because I was in grad school and had people to help me. If you don't have people to help you, then existing materials are very hard to learn from. This book seems perfect for solving that problem.

Five years ago zeds document would have treated you like the x you are.
Thank you zedshaw for doing this. I do hope this will make it to the HN "evergreen" page (if pg ever makes one). It seems like every now and then someone asks how to get started with coding and well now they can.
From the final chapter:

"Programming as a profession is only moderately interesting... You are much better off using code as your secret weapon in another profession.

People who can code in the world of technology companies are a dime a dozen and get no respect. People who can code in biology, medicine, government, sociology, physics, history, and mathematics are respected and can do amazing things to advance those disciplines."

Don't know about the programming profession, but the secret weapon bit is true to a degree that might shock many of the readers here. I would even go so far as to say that NOT knowing how to program causes ridiculous waste of resources in other disciplines.

Working as an epidemiologist during the H1N1 pandemic, I saw literally dozens of man hours drained on repetitive statistical reporting and database tasks that the average reader here could probably automate in under an hour. There were lots of extremely smart people running around with a ton of important things to do, but since no one (myself included) really knew how to program, what were we to do? I think I was the only one to even have the inkling that we could probably be replaced by a few Excel macros.

I don't know this guy's back-story (or why he seems to inspire such antipathy), but this passage got me very excited! I'd already bought into the idea that learning at least the basics of programming would be a good way to improve my general analytic thinking ability (a noble goal, IMHO), but I was being held back by the thought that it was a bit of a frivolous endeavor. This has really inspired me to get started!

Secret weapon indeed! Wooo!

[EDIT: I see several others have commented on this bit. Sorry to be repetitive!]

Yep, that's the idea. Writing a book for programmers isn't really that useful. There's plenty of those and adding one more programmer to the tech scene would be like spitting into the Pacific.

But, if I can improve every other discipline by making it easier for them to learn to code, and then get them to use code to improve things, then that's a much better goal.

That sounds like a good goal indeed. Looking forward to reading it!
How would I get into one of those fields? I would love to be involved in some scientific research or some medical project. I have a solid and wide-ranging tech background, but I've only ever had luck working for tech companies and wouldn't know where to start otherwise.