Skip to content

Commit f4f4e1e

Browse files
committed
-
1 parent 1b3fed5 commit f4f4e1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python_toolbox/cute_iter_tools.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ def iter_with(iterable, context_manager):
167167

168168

169169
def izip_longest(*iterables, **kwargs):
170+
'''
171+
izip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> izip_longest object
172+
173+
Return an `izip_longest` object whose `.next()` method returns a `tuple`
174+
where the i-th element comes from the i-th iterable argument. The `.next()`
175+
method continues until the longest iterable in the argument sequence is
176+
exhausted and then it raises `StopIteration`. When the shorter iterables
177+
are exhausted, `fillvalue` is substituted in their place. The `fillvalue`
178+
defaults to `None` or can be specified by a keyword argument.
179+
'''
170180
# This is a really obfuscated algorithm, simplify and/or explain
171181
fill_value = kwargs.get('fillvalue', None)
172182
def sentinel(counter=([fill_value] * (len(iterables) - 1)).pop):

0 commit comments

Comments
 (0)