make order of function definitions irrelevant

Peter Otten __peter__ at web.de
Mon Nov 10 13:09:30 EST 2003


Joerg Schuster wrote:

> according to
> 
> http://mail.python.org/pipermail/tutor/2001-July/007246.html
> 
> the order of function definitions does matter in python. Does anyone
> know a trick to avoid this? Is there a way to "declare" functions
> without defining them?
> 
> (Making the order of function definitions irrelevant would be useful
> for automatically generated python scripts.)

You cannot *call* a function before it is defined:

fun()
def fun(): pass

will choke. But there is no problem with

def first(): second()
def second(): pass

So I cannot see where this could be an obstacle to script generation.
Could you provide an example?

Peter




More information about the Python-list mailing list