Peter Otten __peter__ at
Sun Nov 2 13:56:14 CET 2003

Daniel Schüle wrote:

> def executer(func, para):
>  func(para)
> def foo():
>  print "function without parameter"
> def bar(a):
>  print "function with 1 parameter"
>  print a
> #executer(foo, None)    #error
> executer(bar, 100)


> is there a way to allow parameterless functions as parameter in executer?

You can change executer() to accept and pass and arbitrary number of

def executer(func, *args):

executer(bar, 100)

However, excecuter(foo, None) will still fail. See for the details.

As an aside, do the newsgroup - and yourself - a favour and increase your
block indent to 4 spaces.


More information about the Python-list mailing list