answered 13 years ago
Does this StackOverflow queston on repeated function application solve your problem?
Python's while/yield generator syntax might also be useful for this.
while
yield