fork download
  1. def f():
  2. a = 3
  3. del a
  4. print a
  5.  
  6. def g():
  7. a = 3
  8. del locals()["a"]
  9. print a
  10.  
  11. for fun in [f, g]:
  12. try:
  13. fun()
  14. except UnboundLocalError as e:
  15. print e
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
local variable 'a' referenced before assignment
3