Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'charset:iso-8859-7': 0.04; 'languages,': 0.04; 'languages.': 0.04; 'subject:Python': 0.06; 'escape': 0.09; 'spelling': 0.09; 'subject:language': 0.09; 'python': 0.11; '*less*': 0.16; '*should*': 0.16; '24,': 0.16; 'backslash': 0.16; 'denotes': 0.16; 'dislike': 0.16; 'lambda': 0.16; 'lambda:': 0.16; 'lie': 0.16; 'lisp': 0.16; 'subject: \n ': 0.16; 'surprising': 0.16; 'there...': 0.16; 'wrote:': 0.18; 'written': 0.21; 'instead.': 0.24; 'tend': 0.24; 'mon,': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'apparently': 0.31; 'languages': 0.32; 'alone': 0.33; 'style': 0.33; 'common': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'scheme': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'aside': 0.39; 'functional': 0.39; 'to:addr:python.org': 0.39; 'users': 0.40; 'ian': 0.60; 'more': 0.64; 'here': 0.66; 'mar': 0.68; 'other.': 0.75; 'subject:this': 0.83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=ZLKp/5kNX6GPs8BsuoJFWPEWLUbQvT8jGnX+LJO6rKU=; b=liKqqy2jjWXE4xX2UFt3UxJvQdfsKya0o4oAhFCYnAoMBKpP36AlJM91fdQLKbtiq1 6CrhNw8Vfy4LNS6w6HtqdGI0Nt3sSPrZ1Q1tFMBWpNo4LI6HxpYm27G90H/wYLL+/M3i uC4//yNrZOtitHcjbpyp4NWcN5O9w9Ps0cFs+jkziV35h4QYhsGbkjaodUIDNRmhbilH QOYZHTRU771SRuSsAL/RjGODXocF4/KBH8s8bsvKtUpGJ+bRb/6FWHM+BEAVeKtbSo0p d1IPUHL1O5ENxW3BhYi2RXKie9IKp9EBrA202oYv9zGWT0c1g1eUYuPVhTYbFKiwPFtW NJPw== X-Received: by 10.66.146.105 with SMTP id tb9mr11610pab.157.1395705532210; Mon, 24 Mar 2014 16:58:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <10101874-2995-4acd-9851-989603f052e3@googlegroups.com> <532d5bd9$0$29994$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Mon, 24 Mar 2014 17:58:11 -0600 Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) To: Python Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395705541 news.xs4all.nl 2891 [2001:888:2000:d::a6]:48597 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68917 On Mon, Mar 24, 2014 at 3:43 PM, Mark H Harris wrot= e: > On 3/24/14 4:03 AM, Ian Kelly wrote: >> >> >> The difference does not really lie in the lambda construct per se but in >> the binding style of closures. Functional languages tend to go one way >> here; imperative languages tend to go the other. {snip} > > >> The result may be more surprising to users accustomed to functional >> languages, but I claim that it is *less* surprising to users of other >> imperative languages. > > > Aside from the sin of spelling out "lambda," > should be ( \x y -> x + y ) a b ) but, neither here nor there... Well no, it *should* be =EBx y . x + y but apparently some people don't have that character on their keyboards, so it gets written as lambda or \ instead. Personally I dislike the \ style; it doesn't really resemble a =EB that closely, and to me the backslash denotes escape sequences and set differences. Nor is Python alone in spelling out lambda: Scheme and Common Lisp spell it the same way. As far as I know the \ for =EB is unique to Haskell.