Return Values & lambda

Rafe Kettler rafe.kettler at gmail.com
Mon Feb 21 23:42:18 EST 2011


On Feb 21, 7:59 pm, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Mon, 21 Feb 2011 16:43:49 -0800, Rafe Kettler wrote:
> > On Feb 21, 1:59 pm, pradeepbpin <pradeepb... at gmail.com> wrote:
> >> I have a main program module that invokes an input dialog box via  a
> >> menu item. Now, the code for drawing and processing the input of dialog
> >> box is in another module, say 'dialogs.py'. I connect the menu item to
> >> this dialog box by a statement like,
>
> >> manu_item.connect('activate', lambda a: dialogs.open_dilaog())
>
> >> If this function open_dialog() returns a list of dialog inputs values,
> >> how can I access those values in the main module ?
>
> > Moreover, I don't see why you need a lambda in this case. Why not just
> > pass the function itself?
>
> My guess is that the callback function is passed a single argument, and
> open_dialog doesn't take any arguments, hence the wrapper which just
> ignores the argument and calls the function.
>
> --
> Steven

That would sound reasonable.

Rafe



More information about the Python-list mailing list