fork download
  1. def mkclosure():
  2. x = "x"
  3. y = "y"
  4. z = "z"
  5.  
  6. def closure():
  7. # Need to reference them for the closure to be created.
  8. return (x, y, z)
  9.  
  10. return closure
  11.  
  12. function = mkclosure()
  13.  
  14. for cell in function.__closure__:
  15. print(cell.cell_contents)
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
x
y
z