Skip to content

Instantly share code, notes, and snippets.

@rks987
Created December 7, 2017 22:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
cons for python generators
def prependGen(hd,tl):
yield hd
yield from tl
if __name__=="__main__":
h = (x for x in range(1,3))
h = prependGen(0,h)
print(*h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment