[Tutor] defining functions

Sean 'Shaleh' Perry shalehperry@attbi.com
Sun, 09 Dec 2001 23:22:14 -0800 (PST)


On 10-Dec-2001 Kirk Bailey wrote:
> At 12/9/01 11:07:00 PM, you wrote:
>>$ python /tmp/foo.py 
>>Traceback (most recent call last):
>>  File "/tmp/foo.py", line 1, in ?
>>    foo()
>>NameError: name 'foo' is not defined
>>$ cat /tmp/foo.py 
>>foo()
>>
>>def foo():
>>        print "foo"
>>
>>looks like you have to define it before you use it (-:  That wasn't too hard.
>>
>>
> That's was in interactive mode, where the thing CANNOT scan a file before
> begin executing it.
> 


um, no, that was "run this script I just gave you" mode.  I told python to run
the script foo.py.  The '$' is my system prompt.