Config: switch from foreach iterator

An iterator is much more natural in python, so let's use that.