Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def loop_without_for(iterable, action_to_do):
- iterator = iter(iterable)
- done_looping = False
- while not done_looping:
- try:
- item = next(iterator)
- except StopIteration:
- done_looping = True
- else:
- action_to_do(item)
Advertisement
Add Comment
Please, Sign In to add comment