Richard Jones' Log
Here's a relatively trivial example of using
dict as a base class to create a dict that returns True or False on item accesses as if
has_key() was called:
class TruthDict(dict): def __getitem__(self, key): return self.has_key(key)
I use this in Zope code(*) to make a simple var that I can shove various strings into and later test for the existence of an arbitrary string. Why not use
has_key()? Because with this code I can perform tests using simpler ZPT path expressions instead of having to use python expressions.
*: of course, being a Zope object used in templating, there's an additional class var
__allow_access_to_unprotected_subobjects__ = 1 (yeah, old school Zope) that I've omitted from the example code to make it more readable.
... just thought I'd let everyone know I was still alive. Just very busy with work and Roundup :)
"Below-average secrets" talks about a couple of fairly crappy "hooks" used by reality shows in their desperate attempts to get viewers. One example is the hugely promoted mystery change to Big Brother. I don't watch the show, but the ads promoting the big mystery were unavoidable - played once or twice every hour for the last couple of months. Then they go on to talk about the big secret being used as a hook to get people to watch Average Joe:
As they walked the orange-filtered beach, out came Larissa's big news: she told Gil how she had once - what? Killed her parents? Sold nukes to al-Qaeda? Traded sexual favours for free BLT subs?
No. Larissa had once dated Fabio. Yeah, and? Well, and nothing. That was it.
Apparently just dating Fabio was enough for Gil, whose dumping of Larissa was so spontaneous they staged it several times for the cameras, resulting in a lovely continuity blooper involving a large piece of vanishing luggage.
One of our radio stations actually had a competition recently where people could ring in with what they thought was the worst ever hook used by a reality show. Apparently the Survivor promos for one episode had this whole thing about a shark attack, with dodgy music and funny camera work. Apparently it turned out that one of the "survivors" caught a baby shark.
After a very long development cycle, I've finally released version 0.7. This one's got a lot of cool new features. Time to do something else for a while though :)
Oh, and I made a cut-n-paste boo-boo again... the announcement to python-announce has "0.6.9" in the Subject line. Last time, the kind moderators rejected it with a little note. I kinda hope they do the same again this time :)
I keep losing Alan's Coffee for Connoisseurs web address, so here it goes into the public memory pool :)
Just placed an order for some Organic Timor Arabica (one of my favourites) and thought I'd give the yummy-sounding Cafe de Cuba a try ("Sweet golden syrup nose and smooth, full bodied middle palate sliding into a rich soft finish.").
Opening a file in a directory like "/usr" in OS X programs is tricky, given that Apple doesn't want users to know about such places. Thanks to Toby, I now have a couple of ways of getting there:
- If it's a file I just want to open with the default program for its type, then I can use the
opencommand, like "open index.html", or
- If I'm stuck using the file dialog, then the apple-shift-G keystroke will let me type a directory location manually.
Ta, Toby :)