faulkner wrote:
(pelase don't top-post - fixed)
> aarondesk wrote:
>
(snip)
>>Now I've tried putting the function declaration after the call but the
>>program wouldn't work. Is there anyway to put function declarations at
>>the end of the program, rather than putting them at the beginning,
>>which
aarondesk wrote:
> I have a little .py file that has the format:
>
>
> def fxn(a):
> do stuff
>
> other stuff
> ...
> r = fxn(a)
>
>
>
> Now I've tried putting the function declaration after the call but the
> program wouldn't work. Is there anyway to put function declarations at
> t
aarondesk wrote:
...
>
> Now I've tried putting the function declaration after the call but the
> program wouldn't work. Is there anyway to put function declarations at
> the end of the program, rather than putting them at the beginning,
> which is rather clunky?
>
> Thanks.
> Aaron
A function can
no.
python is not C. python is interpreted, not compiled, so if you want a
function to exist when you call it, you need to define it before you
call it.
it isn't clunky, it's just how it's done.
if you want to define a 'main' function at the top of your
script/module, go for it. then you can use th