
Zed finishes Learn Python The Hard Way - RyanMcGreal
http://sheddingbikes.com/posts/1285754959.html
======
SteveC
Mongrel 2 and now a book on Python. The man is a machine.

~~~
regularfry
If I remember correctly, he's also currently unemployed. This may be relevant
:-)

~~~
zedshaw
I am, but to be honest, I got more done when I had a job. See all those sites?
I did all of those, wrote for them, worked on LPTHW, wrote mulletdb.com,
hacked on lamson, a few other projects, and still played guitar about 4 hours
a day.

Now that I'm just working on Mongrel2 it feels like I do less. Weird.

~~~
nocman
Geez, man. Do you ever sleep? :-)

Oh, and just out of curiosity, what guitar music are you spending the most
time on? Is it mostly your own stuff, or are you learning a lot of things
written by others?

~~~
zedshaw
I work on Jazz mostly, but older Jazz. Which means I play a lot of scales. :-)

------
shin_lao
Unless I'm mistaken there's no chapter about functional programming in Python
(lambda functions, filter(), map() and reduce()).

I really think it's acceptable to introduce these function to newbies, I'll go
as far as saying it's actually a good thing.

I like the chapter on automated testing.

~~~
jerf
He didn't cover defining first-class functions that I could see in a quick
check, didn't cover generators, and I think most disappointingly, didn't cover
__metaclass__. That's some critical stuff for Python programming right there,
everybody needs __metaclass__.

Ahem.

You have to pick what to cover. For a _beginning Python_ book, I'm
underwhelmed by the need to drag an entirely new and foreign(-to-Python)
paradigm into the beginning Python. I say this as someone who does a lot of
functional programming, someone who is using a lot of lambda, filter, map, and
reduce is someone who is stubbornly refusing to program with the native
idioms, which are named functions (defined inline is fine), list comprehension
or loop, list comprehension or loop, and loop respectively. It is not that
enormous a gain, and will lose from Python fighting you all the way. (Plus
you'll probably miss some opportunities to use generators, overload the
special methods, and the other things you can do with native idioms, if you're
trying to program Haskell in Python.)

~~~
sharms
I have programmed literally hundreds of thousands of lines of python without
using classes or __metaclass__, as a counter example.

When dealing in industry, we can't always hire the best talent, so there is no
need to make things overly complex. Simple solutions work best for a lot of
scenarios, and I haven't been limited by it yet.

Not to bash Perl, but the whole reason we write in Python is because there
were too many people on our team writing in Perl using too many obscure
constructs that took too long to review / revise (especially years later when
team members changed and code was forgotten in parts)

~~~
sigzero
Don't blame Perl. Blame the programmers and your methodology that allowed them
to do that.

~~~
chromatic
You can always delay fixing a social problem by switching technologies.

~~~
jacobolus
You’re implying that language syntax is primarily technical rather than
social. I’m not sure I can agree. The reason that Python code uses standard
idioms most places you go is that the larger-scale Python community is
committed to quite a different set of social norms than the Perl community.

Pulling in that language-community momentum can definitely make a difference
to the social/technical dynamics inside a smaller group.

~~~
chromatic
_You’re implying that..._

... if you have multiple developers who cannot or will not find some way to
write maintainable code, you have a problem independent of language.

I've maintained some hideous code written by people who had no business being
professional programmers. In every case, adhering to a handful of very simple
rules would have improved their code dramatically. Only one case needed a
language change, and that one was away from a proprietary 4GL.

------
MrJagil
I am learning python through this book at the moment. It is my first attempt
at learning to code, so I have nothing to compare it with, but I must say that
this book is very good.

My only gripe is that he poses certain questions/exercises that he fully
expects us to solve, one way or another. But if we cannot; we're screwed. He
does not give the answer. It has only happened once so far, but that was
enough for me to miss out on what seems like a pretty crucial part of the
book.

~~~
mechanical_fish
_He does not give the answer._

Welcome to graduate school! (And, for that matter, real life.)

As in grad school, the secret is: If you can't figure it out, ask around. Form
teams that stay up until 3am waving their hands and sketching on chalkboards.
If nothing else, it's a bonding experience that you'll treasure for life.

~~~
MrJagil
I get your message, but the problem is this is not grad school. This is a
book; one way communication. I have no one to ask, as I am the only one I know
who has an interest in coding.

Of course I can always ask on the web, but having to break off from coding,
pose a question, and then wait for it to get answered before I can continue
really breaks up my learning curve.

~~~
SandB0x
Asking clear questions _will_ help you learn. You can ask on Stack Overflow
(or #python) - make sure to credit the source of your question[0] and at what
point you are stuck. Often by trying to explain the precise thing that you
don't understand, you will have a moment of zen.

[0] People will be a lot more helpful if they know you are trying to learn,
rather than posting a "send me teh codes plz" request. Also they will
hopefully give you just enough of a hint and not spoil the whole thing for
you.

~~~
mgrouchy
_Often by trying to explain the precise thing that you don't understand, you
will have a moment of zen._

This.

I often find that I run into a problem, try to solve it on my own, then bring
someone unfamiliar in to get a fresh set of eyes on it. It usually goes like
this

Me: "Hey, I honestly can't figure out why this is doing this particular thing,
can you take a look? <start explaining problem here in detail> ...FUCK!
Nevermind, I know exactly whats going on. Thanks for your help"

Person I asked: "Huh?Uh sure? I can solve problems with my presence alone"

~~~
rglullis
One of my professors in college would bring a small teddy-bear to the lab.
Whenever one student wanted to ask a question, he would just put the teddy
bear on top of the monitor, and you'd have to talk to the teddy bear first.

It seemed ridiculous, but it worked wonders. Most of the time said professor
didn't have to open his mouth. It was just a matter of organizing your
thoughts in a coherent way.

------
VMG
The last chapter (Advice From An Old Programmer) is very thought-provoking and
slightly unnerving for someone who is studying CS

~~~
trop
It's a lovely chapter! Thanks for pointing it out.

 _Programming as an intellectual activity is the only art form that allows you
to create interactive art. ... . The world needs more weird people who know
how things work and who love to ﬁgure it all out._

It's inspiring to see him talking about the beauty of (software) engineering
as a means of making which has the quality of an art.

~~~
VMG
The chilling part is

 _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.

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._

I have always had the suspicion that this is the case but now I have some
validation

~~~
2mur
Yes. As a physician (pathologist) who is also a hobby-hacker that is
particularly inspiring.

------
RexRollman
Zed,

May I suggest making it available in other formats, assuming that it is
possible, once it is finished? Perhaps as text or HTML files in a tarball? Or
even as an epub (for Nooks and iPad)?

~~~
FraaJad
The source files are written in rst(ReStructured Text) format, the standard
documentation format for Python. Specifically using
[Sphinx](<http://sphinx.pocoo.org>).

One of the default output formats IS HTML.

Build instructions on *nix:

    
    
        $ fossil clone http://learnpythonthehardway.org lpthw.fossil 
        $ mkdir lpthw
        $ cd lpthw
        $ fossil open ../lpthw.fossil 
        $ make html
        $ open _build/html/index.html
    

To install sphinx:

    
    
        $ easy_install sphinx 

or

    
    
        $ pip install sphinx
    

Here you go: a zipped file containing HTML files on google docs.
[https://docs.google.com/leaf?id=0BzdipdlNhpRrNWNmYjFlNmMtZTl...](https://docs.google.com/leaf?id=0BzdipdlNhpRrNWNmYjFlNmMtZTlhNC00NTk2LWE1NmItNzYyYTgwZDY1NzEx&sort=name&layout=list&num=50)

~~~
zedshaw
Please don't put it online in HTML just yet. I need to get it edited, and I'm
afraid people will put versions of the book up in HTML format with errors and
problems. Once the book is 1.0 then I'll have it online and anyone else can
put it online. Can you take your link down please?

~~~
FraaJad
I've taken down the doc.

~~~
zedshaw
Thanks. I appreciate it.

------
jamie_ca
Nice, but that's an annoying license. I'm tempted into porting his assignments
to Ruby, but do to licensing I'll need to do them completely separately - I
can't make a cohesive document out of it.

Ah well. His prerogative I suppose. Just makes me feel like "teaching people
to program" isn't his primary goal.

~~~
zedshaw
Don't copy, imitate. The book was very easy to write. Just lay out 52
exercises, 26 for super basic stuff, 26 for progressively more advanced stuff.
Take about an hour or two every night and write a couple. Pretty simple
really. You may not have my style in your writing, but you'll definitely get a
book that is more Ruby than what I've written.

One warning though, if you think it'll be better to have the book
crowdsourced, think again. Programmers seem to be pretty bad at teaching
programming, so it's best to just write your book and have people give you
feedback as you go.

------
utefan001
I have read the first 20 pages. Excellent! Very well done. Great advice. Fun /
proven way to learn. Thanks Zed!!

~~~
zedshaw
You're welcome. Remember if you run into errors, just submit a ticket for it
on the learnpythonthehardway.org web site and I'll fix them up.

------
emehrkay
Very nice. I just randomly choose to view the arguments unpacking section and
found a defect (no example given on pg 36 for passing in only two args instead
of all three, but later cited as "see how I passed in two args"). Created a
ticket.

~~~
zedshaw
Thanks, I think I fixed it but the ticket is kind of vague:

[http://learnpythonthehardway.org/tktview/08a86ff3098eae91d8c...](http://learnpythonthehardway.org/tktview/08a86ff3098eae91d8c3f9d562200cd6a8b7ab48)

Update it for me if I didn't understand what you think should be done.

~~~
emehrkay
Yeah that's it exactly. You never show

    
    
        python script.py only two_args
    

Just the traceback. It might be confusing to a newbie.

------
gbrindisi
I am training myself in Python with this book from a week or so.

I know how to code in other languages and programming basic so I am not a
first time coder... yet this little book is absolutely useful and I am
enjoying it exercise after exercise.

Learning trough practice FTW!

Thank you Zed.

~~~
zedshaw
Fantastic. Keep on plugging through and if you hit any problems just ask me.
I'm on twitter @zedshaw so just ask and I'll help.

------
statictype
Loved the final chapter.

At the end of the day, it's not about functions or closures or monads. It's
about building something interesting or useful. Whether you used php or arc is
not relevant.

------
Tarks
Thankyou Zed, I'm going to give this a proper read-through before probably
using it to help teach a friend how to learn to program.

------
zeemonkee
I recommended this to a new hire (frontend HTML/JS guy, but wants to learn
Python). He really found it easy to get into, and appreciated the exercises.
Thanks for publishing it.

------
geoscopic
Cool. Why isn't it 1.0?

~~~
jcdreads
Because he "…will now be editing it and doing the index," presumably.

~~~
geoscopic
Good point. Thank you.

------
atomical
I was looking forward to reading through this until I found out that I will go
insane.

\-- It was a joke.

