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:
make copy of your original list, iterate over it, see the modified code below
for a in myarr[:]: if somecond(a): myarr.append(newObj())