Skip to content

Instantly share code, notes, and snippets.

@docapotamus
Created October 5, 2016 13:32
Show Gist options
  • Save docapotamus/896192c5eed7d85854344c436f4806b8 to your computer and use it in GitHub Desktop.
Save docapotamus/896192c5eed7d85854344c436f4806b8 to your computer and use it in GitHub Desktop.
>>> def func1():
... for i in xrange(10):
... yield i
...
>>> def func2():
... for i in func1():
... print i
...
>>> func1()
<generator object func1 at 0x7feb54159960>
>>> func2()
0
1
2
3
4
5
6
7
8
9
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment