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


Groups > comp.lang.python > #82157

Question on lambdas

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Question': 0.07; 'tkinter': 0.07; '(self,': 0.09; 'guys.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tia,': 0.09; 'def': 0.12; '(at)': 0.16; 'lambda': 0.16; 'lambda:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'example': 0.22; 'header:User- Agent:1': 0.23; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'appreciated.': 0.29; "i'm": 0.30; 'class': 0.32; 'another': 0.32; 'trouble': 0.34; 'skip:_ 10': 0.34; 'basic': 0.35; 'but': 0.35; 'gmail': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'reach': 0.63; 'more': 0.64; 'monte': 0.84; 'received:myvzw.com': 0.84; 'so...': 0.84; 'browsing': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From memilanuk <memilanuk@gmail.com>
Subject Question on lambdas
Date Mon, 08 Dec 2014 15:43:18 -0800
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 51.sub-70-199-141.myvzw.com
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16743.1418082212.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418082212 news.xs4all.nl 2843 [2001:888:2000:d::a6]:54856
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82157

Show key headers only | 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