Skip to content

Instantly share code, notes, and snippets.

@deostroll
Created July 29, 2012 07:39
Show Gist options
  • Select an option

  • Save deostroll/3196533 to your computer and use it in GitHub Desktop.

Select an option

Save deostroll/3196533 to your computer and use it in GitHub Desktop.
writing dynamic functions in the python interpreter
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