(self, i)
| 694 | self.c += 1 |
| 695 | |
| 696 | def __getitem__(self, i): |
| 697 | # todo: slices |
| 698 | if i < self.c: |
| 699 | raise IndexError("already passed " + str(i)) |
| 700 | try: |
| 701 | while i > self.c: |
| 702 | next(self.i) |
| 703 | self.c += 1 |
| 704 | # now self.c == i |
| 705 | self.c += 1 |
| 706 | return next(self.i) |
| 707 | except StopIteration: |
| 708 | raise IndexError(str(i)) |
| 709 | |
| 710 | def __nonzero__(self): |
| 711 | if hasattr(self, "__len__"): |