Skip to content

Commit

Permalink
Merge pull request #13 from phihag/patch-13
Browse files Browse the repository at this point in the history
generators: Use range instead of xrange
  • Loading branch information
yasoob committed Aug 17, 2015
2 parents 91a2253 + 9d0b8ed commit e6f8687
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ which calculates fibonacci numbers:
# generator version
def fibon(n):
a = b = 1
for i in xrange(n):
for i in range(n):
yield a
a, b = b, a + b
Expand All @@ -102,7 +102,7 @@ However, if we would have implemented it like this:
def fibon(n):
a = b = 1
result = []
for i in xrange(n):
for i in range(n):
result.append(a)
a, b = b, a + b
return result
Expand Down Expand Up @@ -164,5 +164,5 @@ iterable. Here is how we can use it:
Now that is much better. I am sure that you loved learning about
generators. Do bear it in mind that you can fully grasp this concept
only when you use it. Make sure that you follow this pattern and use
``generators`` whenever they make sense to you. You wont be
``generators`` whenever they make sense to you. You won't be
disappointed!

0 comments on commit e6f8687

Please sign in to comment.