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

Rainer Deyke root at rainerdeyke.com
Tue Jun 26 13:11:12 EDT 2001


"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?


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list