I know that it is not allowed to remove elements while iterating a list, but is it allowed to add elements to a python list while iterating. Here is an example:
Expanding S.Lott's answer so that new items are processed as well:
todo = myarr done = [] while todo: added = [] for a in todo: if somecond(a): added.append(newObj()) done.extend(todo) todo = added
The final list is in done.
done