Political parties face a crucial trade-off between electoral and partisan goals: should they put electoral goals first, pursuing the policies they think will win them the most votes in the next election, or should they put partisan goals first, pursuing the policies their members, activists, and most loyal voters prefer? In this paper we argue that main political parties make different choices depending on the information environment they are in. They have strong incentives to follow the median voter when the median voter's position is well known, but when there is more uncertainty they have strong incentives to adopt policies they prefer for partisan reasons, since uncertainty makes party leaders more willing to bet that the party's preferred policies are also vote winners. We develop an empirical analysis of how the main parties on the left and the right in twenty democracies have changed their platforms from election to election since the 1960s.