Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python.': 0.04; 'terry': 0.07; 'wed,': 0.12; 'subject:python': 0.12; 'am,': 0.13; 'wrote:': 0.15; 'assertion': 0.16; 'iterators,': 0.16; 'reedy': 0.16; 'style,': 0.16; 'subject: \n ': 0.16; 'subject:topic': 0.16; 'protocol': 0.16; 'functions,': 0.19; 'seems': 0.20; 'header:In- Reply-To:1': 0.22; 'format,': 0.25; '(e.g.': 0.25; 'changing': 0.28; 'effect': 0.28; 'all,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'definition': 0.30; 'style.': 0.30; 'equivalent': 0.31; 'functional': 0.31; 'subject:?': 0.31; 'list': 0.32; 'actually': 0.33; 'to:addr:python-list': 0.34; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'common': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'subject:will': 0.64; 'property': 0.65; 'therefore,': 0.66; 'contrary': 0.67; 'subject:have': 0.74; 'subject:this': 0.74; 'hand,': 0.76; 'subject:you': 0.81; 'masking': 0.84; 'notion': 0.84; 'xah': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=dRiXFwwCxoeEbtZ5fO8lVbRqC/2AsHSNfAnAYD/TDyI=; b=lMl+ub31hfZdqpX8NO7waJHRINa++JrzM1pYfe8ZY/BRlzSnZQgyHEefWsdjwxGgo7 98csOfBaQeUYOSEvqirgzHFVb94PO3F/SC7PRzp3bVc4efiHofyo/ps2XMeYfMv80r3y fDe30BTkKPTwkvUvjEXRMWnlY0Wj98+YV3GDg= MIME-Version: 1.0 In-Reply-To: References: <2b28da74-f054-4f46-8971-43603ab7cfd3@glegroupsg2000goo.googlegroups.com> From: Ian Kelly Date: Wed, 13 Jul 2011 11:09:16 -0600 Subject: Re: Functional style programming in python: what will you talk about if you have an hour on this topic? To: python-list@python.org 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310576988 news.xs4all.nl 23848 [2001:888:2000:d::a6]:36110 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9414 On Wed, Jul 13, 2011 at 10:29 AM, Terry Reedy wrote: > The iteration protocol and the notion of iteraables as the common data > exchange format, with associated notions of iterators, generator functions, > and generators, are important features of Python. Not really functional > style, I guess. Xah Lee's assertion to the contrary notwithstanding, it seems to me that list comprehensions are basically functional in style. They are, after all, equivalent to "map(f, filter(g, x))". Iterators, on the other hand, by definition have the property that each call to iter.next() has the side effect of changing the iterator's state. Therefore, although they can effectively be used as a functional building block (e.g. by masking their use with a comprehension), the iterators themselves are not actually functional.