Created
March 5, 2014 03:58
-
-
Save sankalp-khare/9360896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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