script question
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Apr 17 10:23:28 EDT 2009
Marco Mariani wrote:
> Piet van Oostrum wrote:
>
>> funclist = [func01, func02, func03, ... ]
>> for i in range(1,n):
>> funclist[i]()
>>
>> Or myscript.funclist[i]() from another module.
>
> Ehm, calling a bazillion things in the right order should be a
> responsibility of the myscript module anyway.
>
For example, you could do it like:
myscript.py:
funclist = []
def _included(function):
funclist.append(function)
return function
@_included
def func01():
...
@_included
def func02():
...
def call_all():
for function in funclist:
function()
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list