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

Joe Potter jm7potter at hotmail.com
Wed Jun 27 08:35:57 EDT 2001


On Tue, 26 Jun 2001 22:00:52 -0700, "John Roth" <johnroth at ameritech.net> wrote:

>
>"Joe Potter" <jm7potter at hotmail.com> wrote in message
>news:n8dhjt8qmel0ajjae7tv9gmjf60c39qag5 at 4ax.com...
>> On Tue, 26 Jun 2001 16:09:06 GMT, "Rainer Deyke" <root at rainerdeyke.com>
>wrote:
>>
>> >"Joe Potter" <jm7potter at hotmail.com> wrote in message
>> >news:j5ahjtkfmf32lkqtap0q1u6rig385d7b5i at 4ax.com...
>> >>     # the "button" below works like a champ !!
>> >>     #Button(root, text='Fetch',
>> >>                  #command=(lambda v=vars: fetch(v))).pack(side=LEFT)
>> >>
>> >>     # the "button" below does not do anything ??????
>> >>     Button(root, text='Fetch', command=(fetch(vars))).pack(side=LEFT)
>> >

<snip>


>
>Then in effect I'm building an unnamed function definition, and assigning
>default
>values to the two parameters. Those default values will travel with the
>definition,
>so when Tkinter calls it later, they will be availible to the actual
>execution.
>
>The call of foo(a,b) in the definition above is part of the definition - it
>won't be
>executed until the function object is executed later.
>

Thanks John,

I think I see it. If I can get a look at the solution to the code example that I used
in my reply to Chris Barker --- I'll have it made.

Perhaps you can take a look at that example also?

Thanks again.

Regards, Joe



More information about the Python-list mailing list