Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… (sum_it uninteresting)

Made the change detailed in the ticket, namely bringing 'value' into the
loop, making it more obvious that the state of 'value'  is retained between
iterations.
  • Loading branch information
icmurray committed Feb 4, 2011
1 parent b52fe8d commit ff1981a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python 2/koans/about_generators.py
Expand Up @@ -81,7 +81,7 @@ def sum_it(self, seq):
for num in seq:
# The local state of 'value' will be retained between iterations
value += num
yield value
yield value

def test_generator_keeps_track_of_local_variables(self):
result = self.sum_it(range(2,5))
Expand Down
2 changes: 1 addition & 1 deletion python 3/koans/about_generators.py
Expand Up @@ -84,7 +84,7 @@ def sum_it(self, seq):
for num in seq:
# The local state of 'value' will be retained between iterations
value += num
yield value
yield value

def test_generator_keeps_track_of_local_variables(self):
result = self.sum_it(range(2,5))
Expand Down

0 comments on commit ff1981a

Please sign in to comment.