SHARE
TWEET

Closure example

a guest Dec 2nd, 2012 31 Never
  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
RAW Paste Data
Top