Republicans vs. Democrats in Python

February 22nd, 2009

In the US, we’re pretty much locked into a two party system. It’s not that the two parties are founded on two opposing political philosophies — they can and do switch positions — but that once a two party system takes hold, it’s hard to dislodge.

Game theory suggests that a two party system will promote partisanship, especially if there are party-run primary elections. As a result, each party is more likely to elect a more partisan candidate than a centrist.

Peter Norvig has an interesting post, Lieberman, Egg, Sausage and Lieberman exploring a simple simulation. He was motivated by an earlier post by Nate Silver, Land of a Thousand Liebermans, on the fivethirtyeight blog. He wrote some simple Python code to vary some of the assumptions in Silver’s simple model.

This is a great example of using simple programs in Python to explore ideas. We are switching our CS 101 course to Python in the fall and something like this could make an interesting project.