Wandering Thoughts archives

2005-12-15

Another introspection trick

Here's another example of Python's introspection and command interpreter being useful:

[x for x in dir(m) if isinstance(getattr(m, x), str) and 'localhost' in getattr(m, x)]

One of our Mailman lists had been accidentally set up thinking that the machine's name was 'localhost', instead of the machine's actual hostname, and this was causing problems. Mailman is written in Python and offers access to the internals of list data via an interactive Python interpreter (through the withlist program). This one-off bit of introspection was basically a grep over all the lists's attributes.

I won't claim that this would be good style in a program, but as something I typed at the Python interpreter's command line it was very handy. In this, it's like shells and shell scripts; we do things on the command line that we'd never do in shell scripts.

(The isinstance() check is necessary to keep the next clause from potentially throwing an exception on non-string attributes, which would abort the entire list comprehension.)

python/AnotherIntrospectionTrick written at 14:32:52; Add Comment

Reddit versus Digg: a little detail that matters

Since reddit.com and digg.com started showing up on the geek radar, I've been checking them out. Since both are about the same thing, roughly a 'just the links' version of Slashdot's 'news for nerds' approach, I expected to like them about equally, or like digg.com more, since it has link summaries (which are often the most useful bit of Slashdot for me).

To my surprise, I've been barely visiting digg.com, but have found myself dropping by reddit.com frequently; it just felt nicer to use. It's taken me some time to realize why, and it turns out to have come down to one little difference in their website design.

The difference: on reddit.com, I can see what links I've already read; on digg.com, I can't, because digg.com has decided to have unvisited links and visited links be the same colour.

The little extra work of thinking about whether I'd already read an interesting looking digg.com link turned out to be enough of a turnoff that I quietly tuned out. On reddit.com, my browser does the remembering, and my eyes automatically skip over the darker links. No fuss, no muss, continued reading.

Digg also pushes me away with a small font size for the link summary text, the thing I am most interested in reading, forcing me to enlarge it in Firefox in order to read it comfortably. (I've written about this before, and it's even Jakob Nielsen's leading design mistake of 2005.)

Update: and shame on me for not noticing that not differentiating visited and unvisited links is part of Jakob Nielsen's number two design mistake of 2005. And he discusses it in more detail in an older Alertbox here.

web/ALittleDetailThatMatters written at 01:13:10; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.