Listing functions in a file IN ORDER

Ian Sparks Ian.Sparks at etrials.com
Tue Jun 29 15:26:27 EDT 2004


> From: Christopher T King.. 
> 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'.

Good advice. Thanks.

> > functions = ["doTask1", "doThing", "doOther"......]
> > 
> > and iterate over that list?> 
> Better yet, just have a list of the functions themselves:
> 
> functions = [doTask1, doThing, doOther]

Both good ideas but I want the system to do code discovery because I'm too dumb to remember to put things in the list.

> -----Original Message-----
> From: Christopher T King [mailto:squirrel at WPI.EDU]
> Sent: Tuesday, June 29, 2004 12:23 PM
> To: python-list at python.org
> Subject: Re: Listing functions in a file IN ORDER
> 
> 
> 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'.
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list