newbie with major "lambda" problem (perhaps a scope problem as well)

Joe Potter jm7potter at hotmail.com
Wed Jun 27 08:29:52 EDT 2001


On Tue, 26 Jun 2001 17:11:12 GMT, "Rainer Deyke" <root at rainerdeyke.com> wrote:

>"Joe Potter" <jm7potter at hotmail.com> wrote in message
>news:n8dhjt8qmel0ajjae7tv9gmjf60c39qag5 at 4ax.com...
>> My question is *why* the lambda is allowed to call the perfectly defined
>function
>> fetch, but a direct call of fetch is not.
>
>Consider:
>
>def f():
>  return 5
>
>'f' is a function that returns the number 5.
>'lambda: f()' is also a function that returns the number 5.
>'f()' is not a function at all, but just the plain number 5.
>'(lambda: f())()' is also just the plain number 5.
>'lambda: (lambda: f())()' is a function again.
>
>Tkinter wants a function.
>
>Get it now?

I am close. Please see my reply to Chris Barker for the last of my troubles.

I do thank you very much for your kind efforts.

Regards, Joe



More information about the Python-list mailing list