Return the item that will be next returned from ``next()``. Return ``default`` if there are no items left. If ``default`` is not provided, raise ``StopIteration``.
(self, default=_marker)
| 389 | return True |
| 390 | |
| 391 | def peek(self, default=_marker): |
| 392 | """Return the item that will be next returned from ``next()``. |
| 393 | |
| 394 | Return ``default`` if there are no items left. If ``default`` is not |
| 395 | provided, raise ``StopIteration``. |
| 396 | |
| 397 | """ |
| 398 | if not self._cache: |
| 399 | try: |
| 400 | self._cache.append(next(self._it)) |
| 401 | except StopIteration: |
| 402 | if default is _marker: |
| 403 | raise |
| 404 | return default |
| 405 | return self._cache[0] |
| 406 | |
| 407 | def prepend(self, *items): |
| 408 | """Stack up items to be the next ones returned from ``next()`` or |
no outgoing calls