Understanding tuples vs. lists in Python

Python has two seemingly similar sequence types, tuples and lists.

The difference between the two that people notice right away, besides literal syntax (parentheses vs. square brackets), is that tuples are immutable and lists are mutable. Unfortunately, because this distinction is strictly enforced by the Python runtime, some other more interesting differences in application tend to get overshadowed.

One common summary of these more interesting, if subtle, differences is that tuples are heterogeneous and lists are homogeneous. In other words:

Comment Spam Stats

Since January 12th:

  • Valid comments accepted by Akismet: 36
  • Spam comments accepted by Akismet: 17
  • Spam comments rejected by Akismet: 814

I don’t have a number for false positives, but given that I’ve received zero email complaints I’ll assume the number is low if not zero. This gives Akismet about a 98% success rate on catching spam, which is pretty good. It makes my life better. Having more spam comments than real comments get through the gates can be really depressing for a blog owner.

World's ugliest Django app

OK, this is an ugly hack. But also (possibly) cool if you’re into ugly hacks.

I’ve written a small Python script that is a fully functional, self-contained, self-starting Django application. You don’t need to put it on your PYTHONPATH or set DJANGO_SETTINGS_MODULE. You don’t need a web server. It even creates some dummy content for you. I call it jngo.py – it’s somewhat compressed.

The only prerequisites are a Unix-like operating system (i.e. I couldn’t tell you how to make it work on Windows), SQLite and a working install of Django trunk. It is fully “Works on My Machine” certified.

A little something I've been working on

The latest This Week in Django podcast, out today, has an interview with me. I really enjoyed talking with Michael and Brian, and hope I didn’t come off sounding too dorky (or long-winded – I haven’t yet listened to the show, but based on the timestamps in the show notes I could probably use an edit!). I think they do a very good job with the show, and in fact I think that the structure Michael came up with – Tracking Trunk, Branching & Merging, Community Catchup, Tip of the Week – is one that other open source projects would do well to emulate in their news missives.

Free to be, you and wmii

During a quest for things that might make using my spare laptop – an old 800MHz, 256MB thing running Ubuntu – a more zippy experience, I came across “wmii”. It’s a lightweight tiling window manager with a lot of auto-sizing and keyboard control features. I’m really liking it. This laptop has never felt so responsive.

Other similar tools include dwm, xmonad, Ion, and ratpoison. Of the lot I’ve only tried dwm, which was cool but a little too minimal (its customization method, by design, is edit-source-and-recompile). I’m looking forward to trying xmonad once a package makes it into the Ubuntu repositories.

Visualizing trends in the bug-tracker

At work I manage projects with Trac. It’s great. We have about ten different projects, including websites and internal web apps, with most of the code in a central Subversion repository hooked up to Trac so that it’s easy to see what got changed when (and why!).

But rather than bore you with Trac evangelism I’ll share a goofy hack I built to get a basic visualization of the ticket load in Trac over time.

Python was apparently 2007's Language of the Year

I just learned that TIOBE (who maintain a popular but controversial listing of programming language popularity statistics) declared Python the “language of 2007”. Most notably, it is now (according to TIOBE) more popular than Perl:

Last month Python surpassed Perl for the first time in history, which is an indication that Python has become the “de facto” glue language at system level. It is especially beloved by system administrators and build managers. Chances are high that Python’s star will rise further in 2008, thanks to the upcoming release of Python 3.