Skip to content

Commit

Permalink
Create simpleGenerator.py
Browse files Browse the repository at this point in the history
Demonstrate the working of Python Generators
  • Loading branch information
arajb authored Apr 14, 2017
1 parent 8288bab commit 03e52c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions simpleGenerator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Simple example: Generators

def myGenerator():
yield "These"
yield "are"
yield "words"
yield "come"
yield "one"
yield "at"
yield "a"
yield "time"


myGenInstance = myGenerator()

for word in myGenInstance:
print word

0 comments on commit 03e52c2

Please sign in to comment.