Advertisement
themoosemind

Python closure - not working

Jul 20th, 2014
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.09 KB | None | 0 0
  1. def f(x):
  2.     def g():
  3.         x += 1
  4.         print(x)
  5.     return g
  6.  
  7. h = f(2)
  8. h()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement