fork download
  1. closures = []
  2. for i in range(6):
  3. def f():return i
  4. closures.append(f)
  5. for f in closures:print(f())
  6. ###################
  7. print("========================")
  8. closures = []
  9.  
  10. for i in range(6):
  11. j=i
  12. def f():return j
  13. closures.append(f)
  14.  
  15. for f in closures:print(f())
  16.  
Success #stdin #stdout 0.15s 10256KB
stdin
Standard input is empty
stdout
5
5
5
5
5
5
========================
5
5
5
5
5
5