Skip to content

Instantly share code, notes, and snippets.

@astellon
Last active September 6, 2020 04:46
Show Gist options
  • Select an option

  • Save astellon/8374e31635224b7cef85b5adb5e8f852 to your computer and use it in GitHub Desktop.

Select an option

Save astellon/8374e31635224b7cef85b5adb5e8f852 to your computer and use it in GitHub Desktop.

Revisions

  1. astellon revised this gist Sep 6, 2020. No changes.
  2. astellon created this gist Aug 6, 2020.
    8 changes: 8 additions & 0 deletions cycle.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    def cycle(iterable):
    it = iter(iterable)
    while True:
    try:
    yield next(it)
    except StopIteration:
    it = iter(iterable)
    continue