Archive for the 'python' Category

Building a graph-based model of metadata

Wednesday, August 3rd, 2005

I have had some success building an in-memory graph of my iTunes database, in Python. I discovered some rather interesting things about my collection in the process and I’ve started thinking about a way to use this information to cleanly chunk the data.
In my graph, nodes are represented by Python tuples that refer to […]

Using generators to hide loop initialization

Wednesday, June 29th, 2005

How often have you wanted to do a number of things in a loop, but had to move items out of the loop for performance reasons? Here’s a cool use of generators that I just figured out to hide the initialization.

I was trying to use PyICU to get the locale-sensitive hour for the Chandler calendar. […]

cool python tricks

Tuesday, April 26th, 2005

Man I love Python. I came up with a neat trick yesterday that also couldn’t be done in any static language. Needless to say, I’m pretty pleased with myself. This trick isn’t slow or hard to understand, and actually makes a lot of my code very simple, and avoids a lot of boilerplate that I […]