Created
June 12, 2022 23:52
-
-
Save josepsmartinez/1de72a69496208491c184589542b9292 to your computer and use it in GitHub Desktop.
Exhaust Python iterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as in https://stackoverflow.com/a/36763172/4449273 | |
import collections | |
def exhaust_iterator(it): | |
collections.deque(it, maxlen=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment