Tech and travel

Posts

Python logging output file change

2009-08-12

I run unit tests in Python using the standard unittest module. The output should be logged to a file. For this Python has a standard logging library, which is somewhat similar to the logging library for Java. The problem is that there is no easy way to direct the logging to a new file for every test case. Here’s how I got around it. Firstly the setup method of my testcase object contains the following : def setUp(self): self.

Using map with a dictionary in Python

2009-07-21

When you have a dictionary in Python like this : mydict={'first':1, 'second':2, 'third':3} and you want to get the values into a list with a certain order you can do this : mylist=[mydict['first'], mydict['second'], mydict['third']] However, that can get a bit verbose if there are a lot of entries. For every entry you have to repeat ‘mydict’. An elegant way of solving this is using the map function : mylist=map(mydict.get,['first', 'second', 'third'])

Windsor, Stonehenge and Blenheim

2009-06-16

A few weeks ago, I took my parents on a trip to Windsor castle, Stonehenge and Blenheim. The weather was great and the traffic was fine as well.

The moat at Windsor castle, now a garden

The moat at Windsor castle, now a garden

Australia

2009-04-05

I just got back from a brilliant 4 week trip to Australia. It’s a brilliant country, well worth a visit.

Opera House

Opera House

India again

2009-02-22

Here’s another picture of India. The staircase in a house in Jaisalmer is being cleaned.

Inside a house in Jaisalmer

Inside a house in Jaisalmer

Copyright (c) 2025 Michel Hollands