[Zope] function pre-declaration?

philrobinson phil@unitec.demon.co.uk
Mon, 13 Jan 2003 11:17:19 -0000


Sorry, I was not clear enough:
It's a zope python script, so I'm not actually declaring a main() function

I want to do this (in a Zope 'Script (Python)')
++++++++++++++++++++++++++++++++++++++++
# Main starts here
do something...
retval = do_util()
do something else
return something...

# Utility functions start here
def util_func():
  return 'a value'
++++++++++++++++++++++++++++++++++++++++
But I can't because zope doesn't know how to call do_util. In c,
I could just predeclare the function then use it without worrying about
the actual definition which comes along later. Is this possible?
Thanks,
--------------------------------------
Phil Robinson.
philrobinson@ponytrot.net
--------------------------------------



> philrobinson wrote at 2003-1-12 14:28 -0000:
>  > Does python not have a way to predeclare functions,
>  > so I can keep 'main()' at the top and the utils at the
>  > bottom of a file?
> What prevents you from defining "main" at the top?
> 
>   In fact, you can.
> 
>   Only the call to main must be after all referenced global
>   (external) names have been defined.
> 
> 
> Dieter