Hacker News new | past | comments | ask | show | jobs | submit login

It is actually much simpler: you change 'n' as well:

    while i < n:
      if shouldDelete(iterable[i]):
        del iterable[i]; n -= 1
      else:
        i += 1



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: