Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'appropriate.': 0.09; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:language': 0.09; 'url:activestate': 0.09; 'python': 0.11; 'jan': 0.12; ':-p': 0.16; 'magic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'looks': 0.24; 'define': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'url:code': 0.29; 'subject:list': 0.30; 'that.': 0.31; '25,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'method': 0.36; 'mine': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'helps': 0.61; 'received:173': 0.61; 'first': 0.61; "you'll": 0.62; 'hear': 0.63; 'more': 0.64; 'talking': 0.65; 'believe': 0.68; 'mar': 0.68; 'funny': 0.74; 'subject:this': 0.83; 'received:fios.verizon.net': 0.84; 'wait,': 0.93; 'serious': 0.97 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy 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 21:04:41 -0400 References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <10101874-2995-4acd-9851-989603f052e3@googlegroups.com> <532d5bd9$0$29994$c3e8da3$5496439d@news.astraweb.com> <5330b88b$0$29994$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395709505 news.xs4all.nl 2911 [2001:888:2000:d::a6]:46590 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68924 On 3/24/2014 7:07 PM, Chris Angelico wrote: > On Tue, Mar 25, 2014 at 9:58 AM, Steven D'Aprano > wrote: >> On Tue, 25 Mar 2014 06:22:28 +1100, Chris Angelico wrote: >> >>> Aside: You'll often hear people talking about "map-reduce" with big >>> data. Python supports that. Look! >>> >>>>>> map.__reduce__ >>> >>> >>> Oh wait, that's nothing to do with reduce()... >>> >>> *ducks for cover* >> >> Ha ha, very funny :-P >> >> >> http://code.activestate.com/recipes/577676-dirt-simple-mapreduce/ > > That looks like a more serious map/reduce example. Mine came from a > double-take when I was looking at help(map) for some reason; there's a > __round__ magic method that helps define the round() function, there's > __abs__ for abs(), there's __str__ for str()... look, there's a > __reduce__ - it must be to help define reduce()! :) That was my first think also. I believe __pickle__ or __unpickle__ would have been more appropriate. -- Terry Jan Reedy