Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(at': 0.03; 'currently,': 0.07; 'default,': 0.07; 'terry': 0.07; 'expressions.': 0.09; 'object.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'statement.': 0.09; 'unnamed': 0.09; 'pm,': 0.10; 'def': 0.12; 'wrote:': 0.14; 'defined': 0.14; '(lambda': 0.16; 'arguments:': 0.16; 'contrary,': 0.16; 'disagree.': 0.16; 'eliminating': 0.16; 'expression"': 0.16; 'functions;': 0.16; 'lambda': 0.16; 'opposite': 0.16; 'reedy': 0.16; 'shorthand': 0.16; 'so)': 0.16; 'anonymous': 0.16; 'argument': 0.16; 'looked': 0.16; 'language': 0.18; 'jan': 0.20; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'equally': 0.23; 'indicating': 0.23; 'somehow': 0.23; 'function': 0.25; 'object': 0.26; "i'm": 0.27; 'explicitly': 0.29; 'instead': 0.29; 'least': 0.30; 'behaves': 0.30; 'binding': 0.30; 'yields': 0.30; 'equivalent': 0.31; 'done': 0.32; "skip:' 10": 0.32; 'expression': 0.32; 'header:X-Complaints-To:1': 0.32; 'to:addr :python-list': 0.33; 'list': 0.33; 'that,': 0.34; 'option': 0.35; 'there': 0.35; 'header:User-Agent:1': 0.35; 'speaking': 0.36; 'created': 0.36; 'useful': 0.37; 'case': 0.37; 'received:org': 0.38; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'flexibility': 0.39; 'happened': 0.39; 'header:Mime-Version:1': 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'direction.': 0.65; 'here': 0.66; 'making': 0.67; 'intuitive': 0.67; 'commenting': 0.84; 'yours.': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Something is rotten in Denmark... Date: Wed, 01 Jun 2011 13:11:10 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: rain.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306948289 news.xs4all.nl 49184 [::ffff:82.94.164.166]:48099 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6805 On 5/31/2011 8:09 PM, harrismh777 wrote: > At the moment I'm only speaking about my OP and that particular list > comprehension... the thing that happened (at least for me) is that the > intuitive sense that each 'i' somehow becomes a part of the anonymous > function (I know, not so) is built-in. There is little to nothing > indicating in the docs that this is not so On the contrary, the docs very explicitly say that a lambda expression is equivalent to a def statement. "[Lambda forms (lambda expressions)] are a shorthand to create anonymous functions; the expression lambda arguments: expression yields a function object. The unnamed object behaves like a function object defined with def (arguments): return expression" ? Again, what we have here is > the 'i' being saved in a cell and looked up at call time (an > implementation detail, 'late-binding') that is critical for the > user-coder to understand. Again, exactly the same as if the function were created with a def statement. > I'm not commenting on that, but it seems to me that if lambda is going > to remain in the language at all that 'early-binding' in the lambda > specific case would make sense; at least make the lambda more useful > generally. I disagree. Currently, late-binding is the default, with early-binding an option through a few different mechanisms. Making early binding the default would *reduce* the usefulness by eliminating the late-binding option and would add nothing that cannot be done now. There are some people whose 'intuition' is the opposite of yours. They instead want to eliminate the early-binding option of default argument expressions. They want to reduce flexibility in the other direction. Both proposals are equally bad. -- Terry Jan Reedy