[Tutor] defining functions

Kirk Bailey highprimate@howlermonkey.net
Mon, 10 Dec 2001 2:14:7 -0500

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 
>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.

Of course in that mode it has to be defined first. this is not the sense of my question.

When python loads the script, it looks things over. When it detect certain glaring problems, it refuses to 
execute, and growls at me about the broblem.

OK, I will simply write a script and define something simple and workable, and referr to it before defining it 
and see what happens.


In total confusion,
                   Kirk D Bailey

|           Consulting  Agent  Provecateur           |
|    Webmaster, Howlermonkey Email services Co.      |
|   Please visit us at http://www.howlermonkey.net/  |