Skip to content

Instantly share code, notes, and snippets.

@sankalp-khare
Created March 5, 2014 03:58
Show Gist options
  • Save sankalp-khare/9360896 to your computer and use it in GitHub Desktop.
Save sankalp-khare/9360896 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# Author : Sankalp Khare
# Date : [2014-03-05 Wed]
def genFunc():
"""This function generates 3 values (no loop, just to illustrate that its
execution freezes, then resumes)"""
yield ">> Yo Mihira!"
yield ">> Sup!"
yield ">> All good?"
def main():
"""main ka bhi docstring likhwaogey matlab?"""
# genFunc, coz of the yield, returns an iterator
it = genFunc()
print it.next()
print "and here we are back in main!"
print it.next()
print "and again!"
print it.next()
print "bye bye!"
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment