Skip to content

Instantly share code, notes, and snippets.

@prophile
Created August 18, 2014 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prophile/207b5be7204702b3eea4 to your computer and use it in GitHub Desktop.
Save prophile/207b5be7204702b3eea4 to your computer and use it in GitHub Desktop.
import itertools
def tail(seq):
return itertools.islice(seq, 1, None)
def fibs():
yield 0
yield 1
yield from (x + y for x, y in zip(fibs(), tail(fibs())))
print(list(itertools.islice(fibs(), 10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment