More idiomatic Python in example