Minor change to express code as idiomatic Python (EAFP)