Add gentools.run.

This commit is contained in:
voussoir 2021-08-31 19:22:50 -07:00
parent 8eed09c14b
commit ccd3bf72c0
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -13,3 +13,11 @@ def chunk_generator(sequence, chunk_length):
if not chunk: if not chunk:
break break
yield chunk yield chunk
def run(g) -> None:
'''
Iterate the generator and discard the results. Used when the generator has
side effects that are more important than the yielded values.
'''
for x in g:
pass