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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'wed,': 0.04; 'python': 0.07; 'expressions.': 0.09; 'underlying': 0.09; 'programmer': 0.11; 'this:': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'haskell,': 0.16; 'tuple,': 0.16; 'argument': 0.16; 'subject:list': 0.22; 'header:In-Reply-To:1': 0.22; 'e.g.': 0.22; 'somebody': 0.25; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.161': 0.29; 'list': 0.30; 'anyone': 0.31; 'to:addr:python-list': 0.32; 'using': 0.34; 'difference': 0.35; 'none': 0.36; 'two': 0.37; 'should': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'third': 0.38; 'used': 0.38; 'set': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'might': 0.40; '2011': 0.62; '11,': 0.77 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=oASzKUQTIPA38dnje+DLU7PHBhSzHrxpzbkqzGiV5NU=; b=I7KjUMXU5mpSeyZ0MVFRAnRtORWvuWK01Q0N3uBAF+Lz9eKwWv8k566AETsGV9Gglk qySgNyGwOpgmGqhVopk7PNMFFUyxhD+TpRMm68b2xkrwDsxR365XNUsv8JwG1muJXtP7 KGBnnxFgiHYQrII6CAhhgyOmQbOSBivqRqaoQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=MeiqXiqktcyFOZQfQpUym/UbtzmfWM16kJmAXUD288EIUJo5yfcKobUM4L97MKP+7Z jMXSNm8rc8FubRzcyIhShZQ83tpCVDsdl5XCoZ8c6TRW30Os3x7lbG0E28r44e4bh3qN TTuipjDgdiRj7qF++NbwyqmTf4bTpl8/3oTIo= MIME-Version: 1.0 In-Reply-To: References: <9hYwp.5805$xo2.3333@newsfe07.iad> <4dc502c7$0$29991$c3e8da3$5496439d@news.astraweb.com> <4dca9310$0$29980$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Wed, 11 May 2011 10:31:59 -0600 Subject: Re: checking if a list is empty To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 23 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305131550 news.xs4all.nl 81473 [::ffff:82.94.164.166]:36919 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5133 On Wed, May 11, 2011 at 8:34 AM, Hans Georg Schaathun wrote: > E.g. Anyone who has used list/set comprehension in Z, haskell, set theory, > or whereever will understand python list comprehension immediately. They would understand the underlying concept. But would somebody who is not a Python programmer intuitively understand the difference between this: [x + 3 for x in xs if x % 2 == 1] and this: {x + 3 for x in xs if x % 2 == 1} and this: (x + 3 for x in xs if x % 2 == 1) Somebody with rudimentary Python knowledge might even reason that since the first two create a list and a set respectively, the third must therefore create a tuple, which is wrong. None of this should be taken as an argument against using generator expressions.