(result)
| 705 | return result |
| 706 | |
| 707 | def wrap(result): |
| 708 | def next_hook(): |
| 709 | try: |
| 710 | return next(result) |
| 711 | except: |
| 712 | # call the hook at the and of iterator |
| 713 | h() |
| 714 | raise |
| 715 | |
| 716 | result = iter(result) |
| 717 | while True: |
| 718 | try: |
| 719 | yield next_hook() |
| 720 | except StopIteration: |
| 721 | return |
| 722 | |
| 723 | return processor |
| 724 |