
Zed Shaw is Writing A Book Teaching Beginner Python - sverrejoh
http://sheddingbikes.com/posts/1272132621.html
======
pavelludiq
Mr. Shaw, i am once again impressed. This is not the first time I've seen Zed
Shaw rant about something he dislikes and then goes off and attempts to fix
it.

~~~
zedshaw
Thank you. Even though I complain about things, if I think I can fix it I
usually do.

------
fretlessjazz
"If a programmer tells you to use vim or emacs tell them no. These editors are
for when you are a better programmer. All you need right now is an editor that
lets you put text into a file."

Ha! When I started to program, everyone told me the opposite. After weeks of
head scratching and spending more time learning editors than coding, I
secretly switched to Pico. But man could I use the hell out of Pico.

~~~
zedshaw
I'm actually looking for a _simple_ editor that works on all platforms,
doesn't look totally like ass, and is easy to use. I'll then change things up
so people just install that. Basically a GUI cross platform pico would be
perfect.

~~~
isthisaquestion
gedit is cross-platform and pretty easy to use. I never tried the windows port
though. It doesn't look totally native on OSX but it's not bad.

~~~
gtt
windows version as good as the linux one

~~~
kingkilr
It's my primary editor on all 3 platforms, I'd definitely recommend it for
beginners.

------
callahad
I suggest reading the nascent PDF that he's posted, it's very good in some
ways, less good in others, but if Zed keeps it up and is willing to have
others help shape his voice, then this could end up as a very valuable
project.

~~~
zedshaw
I'd like to know what you think is less good.

~~~
callahad
The items on my "less good" list are admittedly subjective, but might be worth
considering as you continue to develop the text. And in this case, I mean
"less good" as "not bad, but not yet great."

For instance, should you be using printf style formatting when string.format
is is available by default in 2.6, Snow Leopard's default python?

A weaker argument could be made for importing print_function from __future__,
but I don't believe the added complexity is worth it, even if it eliminates a
special case.

In Exercise 0, you might want to stipulate a python version, since some
intrepid readers will search out the "latest and greatest" python, and they
_will_ download 3.x unless explicitly told otherwise.

Beyond that, I think some of your prose could be improved. For instance,
"Notice I use a text editor called vim. You shouldn’t use it, it’s too hard to
use for you right now." may be a bit off-putting to someone completely new.

The statement after your listing, however, is perfect:

"If a programmer tells you to use vim or emacs tell them no. These editors are
for when you are a better programmer. All you need right now is an editor that
lets you put text into a file."

~~~
zackola
I think you should bite the bullet and recommend a few text editors on
Windows, Mac and Linux. Or one cross platform one. Some poor bastard is going
to end up wondering why test.py.doc isn't running - and I don't think it's
fair to cast them off as too stupid to program for that.

------
ivenkys
From the book: "You might not really learn “programming” from this book, but
you will learn the foundation skills you need to start learning the language.
"

This is good. There is a place for books like these.

If nothing else, he is at least following-up his "DiveIntoPython is crap"
words with concrete action.

------
simonista
It would be really interesting to sit someone down who is fairly comfortable
surfing the web, answering emails, using iphoto or microsoft word, but who has
never had any experience programming before, and see where they trip up and
where they are bored in working through this.

I know a few people I might be able to talk into it. If I do, I'll report
back.

~~~
zedshaw
If you do, take notes, and let me know every part they have a problem with.
Usually there's some "magic word" or missing bit they didn't know, or that
exercise is just total crap.

~~~
simonista
My brother agreed to try it once school is out in a couple weeks. I think he's
a pretty good candidate: computer savvy and uses a mac, is interested in what
I do but has never tried to learn it before. I'll definitely take notes and
pass them along.

------
petercooper
FWIW, the concept of getting people programming ASAP in order to learn has
been sort of poo-pooed by findings in the ACM:

[http://cacm.acm.org/blogs/blog-cacm/45725-how-we-teach-
intro...](http://cacm.acm.org/blogs/blog-cacm/45725-how-we-teach-introductory-
computer-science-is-wrong/fulltext)

I'm on the fence. I see the music-style logic to picking things up and working
on the practical stuff right away, but, hey, studies are studies.

~~~
zedshaw
Funny, you read that as saying, "Zed's wrong." I read it as, I may be right.
For example:

> no one challenges KSC on the basic premise, that putting introductory
> students in the position of discovering information for themselves is a bad
> idea!

The article doesn't say, "Don't get programmers studying code right away." It
also doesn't say they shouldn't work on problems.

It says that the constructivist approach to teaching by giving students very
little direction on complex problems right way isn't effective. Instead the
direct instruction method of having them work on directed problems to build
initial capabilities is more effective.

This has been the position of the direct instruction school of education for a
while now. In fact, if you actually RTFA they mention that the constructivist
model of is the failing. If you then read the linked articles you'll find the
same thing.

Not a single thing in that linked article supports what you've stated.

~~~
petercooper
_Not a single thing in that linked article supports what you've stated._

I stated: _"the concept of getting people programming ASAP in order to learn
has been sort of poo-pooed"._ This is based on the article stating that
programming "is a bad way to start" and "expecting students to program as a
way of learning programming is an ineffective way to teach."

 _Funny, you read that as saying, "Zed's wrong."_

Why would I have? That would be a meaningless and uninformed judgement. The
_effectiveness_ of the techniques is the interesting part. My observation -
accurate or not - that the article "poo-poos" a technique is not to say that
the technique is "wrong" as linking to an article says little of my opinion,
which I stated as being "on the fence."

------
pgbovine
skimming thru it now, pretty amusing in parts ... from the beginning of
chapter 5:

 _Every programming language has some kind of way of doing numbers and math.
Don’t worry, programmers lie frequently about being math geniuses when they
really aren’t. If they were math geniuses, they would be doing math not
writing ads and social network games to steal people’s money._

jokes aside, this could serve as a good syllabus for giving classroom Python
tutorials for absolute beginners

------
motter
I'd like to hear his opinion on "How to Think Like a Computer Scientist",
which (approximately) matches his description of a beginner's book, and uses
python for the examples.

<http://openbookproject.net/thinkcs/python/english2e/>

~~~
zedshaw
I think it's great. It will be in the list of books to read next for sure,
especially since it's free.

~~~
swaroop
Zed, I've written a beginner's book called 'A Byte of Python', and I'd like to
know your opinion about it - <http://www.swaroopch.com/notes/Python>

FWIW, the background is that it has been under a Creative Commons license
since 2004, it has had about half a million downloads/readers (guesstimate, of
course), is used as a text book for introductory programming courses in at
least 8 universities worldwide, and has been translated to at least 5-6
languages by volunteers.

~~~
zedshaw
Interesting, it does look like a decent book. Also, it looks like you've
targeted Python 3. Seems well written so far based on what I've read in a few
chapters.

I'm building a list of free books for people to move onto after they finish
mine. I'll put yours in the list.

------
tel
I love this style. Notably: "if X doesn't look like Y, something broke.
_Figure out why._ "

Nothing is more important in learning any task than learning how to _keep_
learning, and holding someone's hand too tightly might keep them from trying.
Sink or swim.

Great start, Zed.

------
iamdave
This is the way absolutely every book that aims to teach people a language
should be written. When Ruby on Rails hit it big, I picked up two books and
couldn't get past the first two chapters.

Why?

The first two chapters were filler chapters. The history of ruby, the history
of taking application languages and putting them on the web. An entire quarter
of the book in pages was full of back-story, it was chapter 4 before I even
saw any code, and chapter 6 before the actual instruction even began.

I will certainly buy this book, and if Zed produces any more about other
programming languages in this format, I'm buying them too.

~~~
DannoHung
Okay, but why were you trying to learn Ruby from a book about a web
programming framework for Ruby?

Did you try reading the PickAxe or Why's Poignant Guide?

~~~
Pistos2
He didn't say he was specifically trying to learn Ruby.

------
d0m
From my experience, the coolest thing to do when beginning is to work with a
GUI because you really have the feeling to do something great (contrary to
print hello in a terminal which is more than useless (from a novice point of
view, of course)).

So, my suggestion is to put a small bundle library with a main.py to modify
and learn. For instance, that library could only show a simple dialog which
you can draw and fun with it.

And the exercice might be more about: \- Print the current time in this GUI
(which might be useful) \- Create a small game (such as guess the number,
lower/bigger), \- Generate a close-me button that move when you try to aim on
it.

Etc.. you get the point: easy and fun exercises.

Finally, there are software which abstract the terminal and merge the editing
window with the interpreter. I think this might be way better than saying: try
to find the terminal, learn to create a directory, etc.. Why not creating the
directory directly from the explorer if the user wants to? More particularly,
when you start learning something, _everything_ is new. So it's important to
separate the concept of what you _should_ know and what you are _supposed_ to
learn. So by this respect, creating a directory shouldn't be part of the same
as creating a .py file and writing something in edit for instance.

That's my 2 cents. Good luck and have fun with that :-D

~~~
cdr
_Python For Software Design_ (nee Think Python) does exactly that with its
"TurtleWorld" library, and I think it's a pretty great book.

------
anujseth
I could have called this yesterday, after the spat on twitter, that he's going
to write one. Soldier on Zed.

------
migiale
Hi,

There's a long tradition in ex-USSR math schools and math department of
"teaching by doing", or by solving to be more precise. And I think it gives
superior results given talented and motivated students. have you ever seen
this book?

[http://www.amazon.co.uk/Algorithms-Programming-
Undergraduate...](http://www.amazon.co.uk/Algorithms-Programming-
Undergraduate-Mathematics-
Technology/dp/1441917470/ref=sr_1_3?ie=UTF8&s=books&qid=1272203235&sr=8-3)

it would be really cool to have a book of the same level for python.

------
rabidgnat
Before now, I assumed that teaching programming meant giving exercises where
students figure out how to piece together the fundamentals of programming
languages, and then try to build them up to harder programs. After reading
through Zed's PDF, I realize I may have been wrong! If you let people absorb
ideas by typing existing programs, they won't need to be taught how to
decompose ideas, they'll try new things themselves. To teach game programming,
you don't need to teach every single fundamental and build the user up to
making a full fledged game. You just need to get them to install PyGame and
draw a rectangle that they can move with the keyboard arrows, and tell them
where the documentation is. Anyone who is really interested will do the rest
themselves.

------
iuguy
Interesting. Having read the PDF I think this could do well. I did think that
it was unfairly skewed toward Macs. I know Zed mentioned in the PDF that later
versions would be more Windows/Linux friendly - I guess there's just a need to
try to keep things as agnostic as possible to minimise the effort. I'd be
happy to help with the Windows side where I can if there's alternative stuff
that needs writing for what is likely to be the majority of users.

It might also be worth considering using PyGame later on if there's an
interest in creating more visual programs. I know that it's important to
maintain the interest of people, that's why a lot of the awesome 80s type and
run books would include graphical programs. Again, I'm happy to contribute
where I can.

------
julio_the_squid
A lot of people mention Dive into Python. I'm curious, what are the opinions
out there regarding this online Python book?

<http://homepage.mac.com/s_lott/books/python.html>

------
Avshalom
I like the idea, though I know enough python that it's not for me.

The design/typography kinda sucks though, of course even Zed has pointed out
how hard it is make a good looking code book.

------
jcdreads
Had I had this book when I was ten or eleven I think I would have been the
happiest ten-or-eleven-year-old in the entire world. Like many technical
things, programming is typically either self-taught or taught horribly; this
seems like a completely reasonable attempt to do it right.

Especially since every kid these days knows how to look stuff up online, but
almost no adults know how to teach them how to program from scratch.

------
Kilimanjaro
Easy read, I'd use it if I were learning python.

Now to the critics:

\- Change the book title. If I see it on a shelf I wouldn't pick it. "Easy
Python", "Python: First Steps", "Become a Pythonista" or something more
approachable to the unwashed.

\- PDF sucks for online reading. Big time. Make it one huge html file, no page
breaks, no headers and footers on every page, it sucks. Epub may be a good
choice but I rather use one single html file.

Good work!

~~~
chbarts
> Make it one huge html file

Make this one option. The other option should be one HTML file per chapter (or
subchapter, or thereabouts) for the people who want to use the browser's
bookmark functionality to pick up where they left off.

> no headers and footers on every page

Footnotes, OTOH, are fine if you make them links in both directions (to the
note and back to the body text). Both HTML and PDF can do this, and it makes
it so much less of a pain in the ass to actually _read_ the things when you
know you won't get lost.

------
overgard
I really like this idea of learning things the "hard" way, of doing something
and then figuring out why without a lot of handholding. I think it works for
beginners, but it also works equally well for experts -- for instance if I'm
learning a new language I'd rather just do something and figure out why it's
acting in the way it is, rather than read through a chapter explaining it.

------
stcredzero
What I've found is that the best thing for learning programming is something
that can run programs, and example programs to run and debug. That's been true
ever since I started playing with BASIC on the Apple II. I've also found that
dynamic languages are better, since they provide immediate feedback.

------
Chuuwudo
I looked through what he has written so far and it seems to be really nice. I
might give it a try as I have no experience in Python (my only programming
experience is writing simple Bash and PowerShell scripts). I do, however, wish
he had made it available in HTML as well as PDF.

------
brianjherman
Can he make a mean, dirty, nasty version? Like the former blog. I miss the
angry in your face Zed Shaw.

------
leed25d
I think that David Beazley's "Essential Python" is the best introduction to
Python that I have seen.

------
jpwagner
_Search online for all of the Python format characters._ \- page 16

Awesome! Not your usual textbook exercise.

~~~
chbarts
> Not your usual textbook exercise.

Textbooks _do_ seem to exist as if the Internet weren't usable, don't they? At
most they seem to have a few URLs to the publisher's and author's websites.
It's actually kind of sad, as if textbook authors didn't trust themselves to
outdo what people can find online. Zed does not seem to have that problem.

------
heresy
Look forward to seeing where this goes.

My girlfriend asked me to teach her Python - she's doing her masters in
statistics, so she's coming from an R/SAS background.

Apparently Python is useful to know in the investment banking arena, which
surprised me.

~~~
zedshaw
Yes, the SEC has recently suggested that all banks encode their financial
calculations in Python.

But, tell your girlfriend that if she ends up working for a bank I will cry
and take my book away from her. :-)

------
grandalf
This is pretty darn good. I would probably do it a bit differently but I think
he's off to a very good start.

I think an example like:

print "hi there", "how are you"

with a brief explanation of the argument structure of print would be helpful.

This makes me want to write a tutorial.

------
DarwinLann
I have to admit that I find Zed's comments about DiP to be spot on. I hate
saying that, because I actually have a favorable opinion of both Mark Pilgrim
and his blog.

------
gastlygem
Chapter 10.2 -- "False or True" should be "True" I think..

------
cracki
i see some strange things in the truth tables.

first, the left and right operands are ordered differently. on second glance,
this smells like gray code, so only one operand changes to the next line.
nevermind my reaction here.

then, the NOT AND table contradicts what python evaluates the forms to.

~~~
cracki
uh, after revisiting the tables in the PDF, i understand the situation better.

the NAND and NOR tables don't follow the same evaluation scheme.

the NOR table is "(not A) or B", which is according to python's precedence
rules without parentheses.

the NAND table is "not (A and B)", which matches the common definition of
NAND.

------
theBobMcCormick
So is that why he was trashing Dive Into Python? Trying to discredit the
competition?

~~~
steveklabnik
Get the story from the horse's mouth: <http://oppugn.us/posts/1272050135.html>

~~~
ern
I decided to learn Python recently, and I ran into "Dive Into Python" as a
recommended resource (I think I Googled "Python book"), and it almost did put
me off the language. It's not really the author's fault, it is the fault of
those who recommend it.

~~~
dirkstoop
I remember trying to read it way back when. It came recommended as 'the book'
to read about Python.

Besides the ODBC stuff etc. that Zed comments on (never dived into the book
that deeply) its biggest problem is that the writing style is extremely,
annoyingly, time-wastingly redundant.

I remember it explaining the same stuff over and over, worded slightly
differently, easily spanning a dozen pages for every simple thing. After the
n-th "I got it the first time, move on!" feeling I stopped reading it.

~~~
nlawalker
I'm in the same boat. I really tried to make use of it to learn Python, but it
just spends a lot of time going into detail that an interested reader should
be able to infer by doing exercises.

I'm actually a big fan of that kind of writing, and I tend to write in that
way myself, but it doesn't work for "intro" or "tutorial" books. Jon Skeet's
"C# In Depth" is a good example of a book that spends time making sure you
really understand a concept six ways from Sunday, but that's the advertised
point of the book. When it comes to learning something like a new language, I
think Mr. Shaw's on to something, but to be honest I'd rather see sets of
exercises like this become a wikified, edited-for-quality community project.
The examples in the sample PDF are geared at beginners, but there's no reason
that a larger set of simple examples and drills couldn't be created by topic
(here's how to do stuff with databases; here's how to ping a server; here's
how to talk to a web service) for more experienced users that grok the
language and are more interested in learning the libraries.

Anyways, the thing I like about this idea the most is that it puts you in
front of a machine with programming tools and has you make progress by _doing
things_ , not by reading prose.

------
bcl
Post the Sphinx source to github so we can start submitting patches.

------
giardini
re Section 10.2: I'd suggest defining operator precedence rather than asking
the programmer to, for example, memorize tables of logical operations.

------
bslatkin
Go for it, Zed!

------
dotandimet
The first example print statements in Zed's book have backticks (`foo`). I
don't know Python, but I'm guessing those should be single ticks ('foo')?

~~~
Estragon
Not in the rendering I see.

But backticks are valid python syntax, but relatively unused, these days. The
contents of backticks are evaluated, and the result is returned as a string
representation.

    
    
      >>> `1+1`
      '2'

------
terra_t
zed's dead baby

~~~
pesho
whose motorcycle is this?

