Created
July 29, 2012 07:39
-
-
Save deostroll/3196533 to your computer and use it in GitHub Desktop.
writing dynamic functions in the python interpreter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Python 2.7.3 (default, Apr 20 2012, 22:44:07) | |
| [GCC 4.6.3] on linux2 | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> def print_hello(): | |
| ... print 'Hello foo world' | |
| ... | |
| >>> print_hello() | |
| Hello foo world | |
| >>> #some other arbitary function call | |
| ... #will result in an error | |
| ... foo() | |
| Traceback (most recent call last): | |
| File "<stdin>", line 3, in <module> | |
| NameError: name 'foo' is not defined | |
| >>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment