Brad's Blog

The little things 2013-12-29

I ran across an interesting line of code today, and thought I'd share some insights. First, though we need a little context. Imagine reading several lines of data from a csv file (using python's built-in csv module). You'll typically have some code that looks something like this: import csv with open('data.csv', 'rb') as csvfile: reader = csv.reader(csvfile) for row in reader: # Do some stuff with each row, # where the row is a list of ...