python_koans
python_koans copied to clipboard
about scope
Hey, looks like typo in about_scope.py:73
def test_incrementing_with_local_counter(self):
global counter
start = counter
self.increment_using_local_counter(start) # should be `counter` instead of `start`
self.assertEqual(False, counter == start + 1)
Yes, in both cases the answer is False. But logically in start
we should keep initial value and then compare with ~~modified~~ counter
.
Well... I'm going to make admission. I wrote this a long time ago. I have hardly any recollection of writing this koan at all. But... looking back at it with fresh eyes this compared with the next koantest_incrementing_with_global_counter
is super confusing. I can see my intent was to show the difference in scope but this doesn't prove it at all well, because the tests for local vs global counters are almost identical!
So I'll throw down the gauntlet. If someone wants to make a cool contribution to Python Koans, this is a great place to start!
I would like to work on this issue.