Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'wed,': 0.04; 'kelly': 0.09; 'subject:()': 0.09; 'pm,': 0.11; 'described': 0.14; 'wrote:': 0.14; 'definition,': 0.16; 'in?': 0.16; 'lambda': 0.16; 'subject:List': 0.20; 'seeing': 0.21; 'code': 0.22; 'header:In- Reply-To:1': 0.22; 'received:209.85.214.174': 0.23; 'received :mail-iw0-f174.google.com': 0.23; '\xa0if': 0.23; 'calling': 0.25; 'creating': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'class': 0.29; 'elements': 0.29; 'all.': 0.30; 'if,': 0.31; 'to:addr:python-list': 0.32; "isn't": 0.34; 'there': 0.35; 'running': 0.36; 'received:209.85': 0.37; '20,': 0.38; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'unless': 0.38; 'received:209.85.214': 0.39; 'explain': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'body': 0.62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=HDvXV65pTZL4dc4WNUtYFwByx1z2YVTe+IncI/1agwA=; b=SxxNeOdiuTjdTXi4r/D/5m84tfi6bYZ57jMd9tQfXC6bG7FO5uPlNf7+KC0xGGwRjE VjaTuzD3bHuNOPTL0d2HYVQBO0LPU2P0WVbz9gqrDqQvmNKBTYg/KMB3eHcvy/0zeNOA VEgi9xK5t/JfxjQ8fsWmDvtL8+1HYvaLFy/L0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=tmkc3XlxbUTH9DvWRPgwU9DH09ntb+35vN5EAczAUaoFLW+rKlbHGzws2ApbjLs68A 3SmKG1qQVeWj73f+I8v2FSn9AIbwm3LEbd8lspab5yrq5s/J9YtKXtvaaTu3WPCU7Jre XYuIT7G0CzjVTDTHxAz2nZx6i2RpIbNvR3rM4= MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 20 Apr 2011 16:22:41 +1000 Subject: Re: List comprehension vs filter() From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 15 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303280564 news.xs4all.nl 81484 [::ffff:82.94.164.166]:48867 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3656 On Wed, Apr 20, 2011 at 4:08 PM, Ian Kelly wrote: > What is the scope the code is running in? =A0If this is part of a class > definition, that could explain why the lambda is not seeing the type / > posttype closure: because there isn't one. It's inside an if, but that's all. The body of the code has: if len(lst): posttype=3D... lst=3D... No other structural elements to get in the way - unless calling the code as described is creating one. Chris Angelico