Don't modify iterables as you iterate over them. That is to say, don't change info in a for x in info: block. Instead create a new list and then set info equal to it. You can give an argument a default value, which allows for calls to not explicitly set that value.