fork(1) download
  1. value = "global"
  2.  
  3. def ex1():
  4. def f():
  5. def f():
  6. print("value scope: ", value)
  7. f()
  8. f()
  9.  
  10. def ex2():
  11. value = "outer local"
  12. def f():
  13. def f():
  14. print("value scope: ", value)
  15. f()
  16. f()
  17.  
  18. def ex3():
  19. def f():
  20. value = "inner local"
  21. def f():
  22. print("value scope: ", value)
  23. f()
  24. f()
  25.  
  26. def ex4():
  27. def f():
  28. def f():
  29. value = "very local"
  30. print("value scope: ", value)
  31. f()
  32. f()
  33.  
  34. ex1()
  35. ex2()
  36. ex3()
  37. ex4()
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
value scope:  global
value scope:  outer local
value scope:  inner local
value scope:  very local