Monday, July 30, 2007

A brief reaction to "Find the Bug"

I picked up a copy of Adam Barr's Find the Bug, which is a cool concept for a book. (5 languages, 50 programs, 50 bugs; see if you can spot them.)

I found the bug in the first program, in C, then skipped to the Python chapter. The first two programs were not too bad, as pedagogical exercises go (although iterating through substrings instead of a.startswith(b) in the 2nd was painful). The third, though, was "Alphabetize words," 25 sloc to perform the equivalent of

def alphabetize(buffer):
  L = buffer.split(' ')
  L.sort()
  return L

... doing everything about the hardest way possible.

Now, it's pretty hard to introduce a non-obvious bug into my version of this function, so it wouldn't be appropriate for Mr. Barr's book when written this way. But the right thing to do is to make the task more difficult, not dumb Python down to the level of C! It's very very painful to read Python written like that.

(Actually it's painful to read any language written at such a low level of expressivity, which is why I prefer not to use languages that really can't do any better.)

Monday, July 23, 2007

Final version of OSCON SQLAlchemy slides

http://utahpython.org/jellis/sa-tutorial-oscon.pdf

Also the code snippets:

This is what I'll be using in my tutorial tomorrow.

Update: I forgot to "svn up" on my web server. So now the final version is up.

Monday, July 09, 2007

PEP rss feed is live

After I complained that python.org could use a PEP rss feed, David Goodger invited me to volunteer to write one. So I did. (With Martin v. Löwis doing the integration with the site build script. Thanks Martin!)

The feed is live at http://www.python.org/dev/peps/peps.rss.