Blog

Python function for displaying a list of dictionaries in table format

December 3, 2010

I just spent like 2 hours writing this function, but it was worth it!

This cut down a lot of duplicate code on the project I'm working on. I figured I'd post it here in case someone is trying to do the same thing. I'm sure my code is not optimal so if you have any suggestions on how to improve it please feel free to comment :).

from operator import itemgetter

def format_as_table(data,
                    keys, …

Macy’s Thanksgiving Day Parade 2010

November 26, 2010

I was at the bookstore last week and I saw this book (or magazine, can’t remember) about this list of events to attend before you die. Among them were Mardi Gras, Carnivale, and then the Macy’s Thanksgiving Day Parade came up. I was like, “hey, that’s coming up soon and it’s only about an hour away, I should check it out” and so I did.

I actually haven’t paid much attention to it before, I’ve …

How to retrieve the name of the calling module in Python

November 23, 2010

I was writing some Python code yesterday and I was wondering if there’s a way to retrieve the name of the module making the call to another module so I can log it automatically. I found this post that gives an example on how to do it using the built-in inspect module (I had to modify the sample code a little bit to make it work).

It looks like you can use this module to …

Maui

November 22, 2010

I was in Maui on vacation from August 5-12 (I know, very late post, I’ve been lazy) and I have to say that this is one of the best places I’ve visited so far! Very relaxing, plenty to see and do, and perfect weather every day. If you like nature type activities you won’t be disappointed, but if you’re looking for more of a party atmosphere you may want to visit the other islands of …

Beijing, China

November 21, 2010

This is just to summarize my experiences from my recent trip to Beijing before I forget them :).

We arrived at the Beijing International Airport on Thursday night, October 21. First thing I noticed was the air quality as we were approaching the exit, you can smell the pollution. Once outside, you’ll see taxis lined up and you just pick the one in front, we had to take two taxis because our luggage wouldn’t fit …