Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!zen.net.uk!dedekind.zen.co.uk!feeds.phibee-telecom.net!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:verizon.net': 0.07; 'terry': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'suggestion.': 0.09; 'programmer': 0.11; 'subject:python': 0.12; 'am,': 0.13; 'wrote:': 0.15; 'java.': 0.16; 'rainer': 0.16; 'reedy': 0.16; 'showcased': 0.16; 'subject: \n ': 0.16; 'subject:topic': 0.16; 'suggested.': 0.16; 'help.': 0.19; 'jan': 0.19; 'java': 0.21; 'filter': 0.22; 'header:In-Reply-To:1': 0.22; 'steve': 0.24; 'there.': 0.25; 'function': 0.26; 'tried': 0.27; 'sort': 0.28; 'all,': 0.28; 'partial': 0.29; 'example': 0.30; 'anthony': 0.30; 'carl': 0.30; 'logic': 0.30; 'thanks': 0.31; 'functional': 0.31; 'subject:?': 0.31; 'ambitious': 0.32; 'programming.': 0.32; 'list': 0.32; 'too': 0.32; 'does': 0.32; 'implement': 0.33; 'to:addr:python-list': 0.34; 'header:X -Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'similar': 0.37; 'response': 0.37; 'but': 0.37; 'using': 0.37; 'received:org': 0.38; 'takes': 0.38; 'subject:: ': 0.38; 'everyone': 0.38; 'think': 0.38; 'header:Mime-Version:1': 0.39; 'got': 0.39; 'to:addr:python.org': 0.39; 'introduced': 0.40; 'did': 0.40; 'subject:will': 0.64; 'minutes': 0.67; 'lost': 0.73; 'subject:have': 0.74; 'subject:this': 0.74; 'advantages': 0.77; 'introduce': 0.79; 'subject:you': 0.81; 'gotcha': 0.84; 'kong': 0.84; 'by.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Aw: Re: Aw: Functional style programming in python: what will you talk about if you have an hour on this topic? Date: Mon, 18 Jul 2011 16:02:54 -0400 References: <2783b9f2-89ea-4823-ae80-6ac9686ec7ce@glegroupsg2000goo.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: <2783b9f2-89ea-4823-ae80-6ac9686ec7ce@glegroupsg2000goo.googlegroups.com> 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311019510 news.xs4all.nl 23867 [2001:888:2000:d::a6]:36950 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9833 On 7/18/2011 8:20 AM, Anthony Kong wrote: > Thanks for all the great suggestion. > > First of all, Carl is right that it does not take much to impress a > java programmer about the expressiveness of functional programming. > Covered map, reduce and filter as Rainer suggested. > > Emphasized the advantages of functional style as summarised by Steve > D'Aprano. > > I showcased the use of groupby() in itertools. Think about what it > takes to implement similar logic in Java. Also introduced the gotcha > of using groupby(): you must first sort the list in the same way you > want to group them by. > > > Then I got ambitious and tried to introduce partial(). I basically > lost everyone right there. They can understand what partial does but > do not know why it can be useful. My example was too trivial and it > did not help. What is the best way to introduce partial/currying? See my response to Kurian -- Partial Function Application -- just a few minutes ago. -- Terry Jan Reedy