Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'wiki': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'subject:Python': 0.06; 'explanation': 0.09; 'filter,': 0.09; 'lawrence': 0.09; 'library?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spaces': 0.09; 'subject:language': 0.09; 'themselves,': 0.09; 'python': 0.11; 'language.': 0.14; '"a"': 0.16; '"thanks': 0.16; 'does,': 0.16; 'investigate': 0.16; 'joys': 0.16; 'lambda': 0.16; 'partly': 0.16; 'pov,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; 'trying': 0.19; 'examples': 0.20; 'work,': 0.20; 'example': 0.22; 'import': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'guys': 0.24; 'helpful': 0.24; '---': 0.24; 'question': 0.24; 'sort': 0.25; "i've": 0.25; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; 'am,': 0.29; 'expanding': 0.29; 'points': 0.29; 'words': 0.29; 'then.': 0.30; 'subject:list': 0.30; "i'm": 0.30; 'gives': 0.31; 'asks': 0.31; 'with,': 0.31; 'another': 0.32; 'quite': 0.32; 'ago': 0.33; 'copying': 0.34; 'there,': 0.34; 'maybe': 0.34; "i'd": 0.34; 'but': 0.35; 'add': 0.35; 'really': 0.36; 'thanks': 0.36; 'similar': 0.36; 'list': 0.37; 'starting': 0.37; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'how': 0.40; 'improved': 0.60; 'free': 0.61; 'ago.': 0.61; 'viruses': 0.61; 'providing': 0.61; 'protection': 0.63; 'real': 0.63; 'decided': 0.64; 'our': 0.64; 'interest': 0.64; 'become': 0.64; 'provide': 0.64; 'more': 0.64; 'great': 0.65; 'situation': 0.65; 'antivirus': 0.68; 'viewed': 0.74; 'subject:this': 0.83; 'received:2': 0.84; 'absolutely': 0.87 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) Date: Mon, 24 Mar 2014 19:13:13 +0000 References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <10101874-2995-4acd-9851-989603f052e3@googlegroups.com> <532d5bd9$0$29994$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-198-214.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: X-Antivirus: avast! (VPS 140324-1, 24/03/2014), Outbound message X-Antivirus-Status: Clean 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395688415 news.xs4all.nl 2891 [2001:888:2000:d::a6]:43499 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68894 On 24/03/2014 18:58, Mark H Harris wrote: > On 3/24/14 4:58 AM, Mark Lawrence wrote: >> Where do you get reduce from if it's not in the standard library? > > That was "a" proposal for 3000. Its there, but its not on the > built-ins; ie., you have to import it. The confusion: why reduce, why > not filter, nor map? {rhetorical} So it is in the standard library then. And I'm not confused, seeing this must have been decided years ago as Python 3 was released some five years ago. > >> As for lambda I've no real interest in it, other than when copying >> examples >> where it's used to (say) provide a key function. >> > > This is one of my main points to Steven. In my experience "most" people > do not intend to use lambda for anything; they are trying to sort this > or that and don't quite know how to get the key right and some helpful > somebody gives them a key=lambda yadda yadda . They use it, and it > works, but they are scratching their head saying to themselves, "what it > that, how does it work, how can I understand it and on and on". More fool them, I write Python as I let it take away the head scratching, not add to it. If I wanted to start head scratching maybe I'd go and investigate what line 247 of gcmodule.c does, but funnily enough I've never been there, and don't intend starting now. > > That is what we mean by confusing. Or another really great example is > this thread. Somebody asks about a language feature and somebody else > helpfully answers the question by providing them with a similar lambda!! One of the joys of this list from my POV, YMMV. > > Its the programmer's equivalent of explanation by reference to a more > complicated analogy; which leaves the OP left with, "Thanks for all the > responses". > > marcus > > PS You are absolutely right, all the expanding double spaces become > very annoying when viewed on Thunderbird; it is exasperating, genuinely. > Yep, but like I said the situation has improved, partly thanks to the guys who improved the words on the wiki showing how to successfuly use gg. Thanks fellas :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com