None

Mel Wilson mwilson at the-wire.com
Sun Nov 2 09:19:06 EST 2003


In article <bo2t4k$p3f$1 at news.rz.uni-karlsruhe.de>,
"Daniel Schüle" <for_usenet2000 at yahoo.de> wrote:
>Hi NG
>
>
>
>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)
>
>print type(foo)
>print type(bar)
>#seem to have the same type, though one takes parameter and the other doesnt
>
>does this mean that None *is* a value
>some special value to show that variable cant be initialized with more
>appreciate value
>at this stage?

That's what it means.  The way to call foo is `foo()`.
>
>is there a way to allow parameterless functions as parameter in executer?

        def executer (func, para):
            foo (*para)

will allow you to specify the parameter list explicitely.  Then

        executer (foo, ())
...
        executer (bar, (1,))
...
        def baz (a, b):
            print "2 params:", a, b

        executer (baz, (1, 2))



        Regards.        Mel.




More information about the Python-list mailing list