Advertisement
Guest User

Closure example

a guest
Dec 2nd, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. computed = False
  2.  
  3. def get_value():
  4.     global value
  5.     if not computed:
  6.         value = compute_value()
  7.         computed = true
  8.     return value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement