Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82157

Question on lambdas

From memilanuk <memilanuk@gmail.com>
Subject Question on lambdas
Date 2014-12-08 15:43 -0800
Newsgroups comp.lang.python
Message-ID <mailman.16743.1418082212.18130.python-list@python.org> (permalink)

Show all headers | View raw


So... I was browsing some questions on reddit, and one of them involved 
tkinter and lambdas.  Managed to help the person out, but in the process 
ended up with more questions of my own :/

My basic confusion revolves around this: in one instance I see things 
like the following:

R1 = tk.Radiobutton(root, text='A', value=100, variable=var,
                     command=lambda: update_label2('A', 100))

and in another example I see things like this:

class MyText(Text):
     def __init__(self, master, **kw):
         apply(Text.__init__, (self, master), kw)
         self.bind("<Return>", lambda e: "break")


What I'm having trouble finding a concrete answer to is the difference 
between:

lambda: some_func

lambda e: some_func

lambda e=e: some_func

Any help would be greatly appreciated.

TIA,

Monte

-- 
Shiny!  Let's be bad guys.

Reach me @ memilanuk (at) gmail dot com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Question on lambdas memilanuk <memilanuk@gmail.com> - 2014-12-08 15:43 -0800

csiph-web