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


Groups > comp.lang.python > #82157 > unrolled thread

Question on lambdas

Started bymemilanuk <memilanuk@gmail.com>
First post2014-12-08 15:43 -0800
Last post2014-12-08 15:43 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#82157 — Question on lambdas

Frommemilanuk <memilanuk@gmail.com>
Date2014-12-08 15:43 -0800
SubjectQuestion on lambdas
Message-ID<mailman.16743.1418082212.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web