Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. On Ubuntu 14.04:
  2.  
  3. $ python --version
  4. Python 2.7.6
  5.  
  6. $ python
  7. Python 2.7.6 (default, Oct 26 2016, 20:30:19)
  8. [GCC 4.8.4] on linux2
  9. Type "help", "copyright", "credits" or "license" for more information.
  10. >>> def print_arg(arg):
  11. ...     def do_print():
  12. ...         print(arg)
  13. ...     exec('do_print()', {}, {})
  14. ...
  15.   File "<stdin>", line 4
  16. SyntaxError: unqualified exec is not allowed in function 'print_arg' it contains a nested function with free variables
  17. >>>
  18.  
  19.  
  20. On OS X 10.11.6:
  21.  
  22. $ python --version
  23. Python 2.7.10
  24.  
  25. $ python
  26. Python 2.7.10 (default, Oct 23 2015, 19:19:21)
  27. [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
  28. Type "help", "copyright", "credits" or "license" for more information.
  29. >>> def print_arg(arg):
  30. ...     def do_print():
  31. ...         print(arg)
  32. ...     exec('do_print()', {}, {})
  33. ...
  34. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement