Skip to content

Instantly share code, notes, and snippets.

@sillyfellow
Created July 29, 2015 12:25
Show Gist options
  • Save sillyfellow/ea2eb99e996cc481ac0e to your computer and use it in GitHub Desktop.
Save sillyfellow/ea2eb99e996cc481ac0e to your computer and use it in GitHub Desktop.
def cons(list, count):
if count <= 0:
count = 1
for i in range(len(list) - count + 1):
yield list[i: i+count]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment