Listing functions in a file IN ORDER

Christopher T King squirrel at WPI.EDU
Tue Jun 29 12:22:55 EDT 2004


On Tue, 29 Jun 2004, Irmen de Jong wrote:

> Ian Sparks wrote:
> 
> Just add a list which sums up the function names in the order you want:
> 
> functions = ["doTask1", "doThing", "doOther"......]
> 
> and iterate over that list?

Better yet, just have a list of the functions themselves:

functions = [doTask1, doThing, doOther]

for function in functions:
    function(*args)

Note the use of function(*args) instead of apply(function,args). apply() 
is deprecated starting with Python 2.3 in favor of this 'extended call 
syntax'.




More information about the Python-list mailing list