1
0
Fork 0
mirror of synced 2024-06-26 10:00:19 +12:00

add peekable docstrings

This commit is contained in:
Nick Sweeting 2018-06-10 18:45:49 -04:00
parent f78838ef40
commit 91e7e0cd36

View file

@ -3,6 +3,10 @@ from collections import deque
_marker = object()
class Peekable(object):
"""Peekable version of a normal python generator.
Useful when you don't want to evaluate the entire iterable to look at
a specific item at a given idx.
"""
def __init__(self, iterable):
self._it = iter(iterable)
self._cache = deque()