Entries from 2008-07-31 to 1 day

Using closure in Python(2)

先日のエントリで、Pythonのクロージャについて記載しました。問題のコードは以下のようなものでした。 counter1.py: #!/usr/bin/python -t def make_counter(): x = 0 def counter(): x += 1 print x, return counter return counter make_counter()()()() …