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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:when': 0.07; '*function*': 0.09; '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; 'run.': 0.09; 'subject:python': 0.11; 'cares': 0.16; 'enlighten': 0.16; 'executed.': 0.16; 'finney': 0.16; 'received:173.11': 0.16; 'subject:function': 0.16; 'subject:writing': 0.16; 'written': 0.16; 'enormous': 0.18; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'runs': 0.23; 'works.': 0.23; 'code': 0.25; 'writes:': 0.25; 'van': 0.26; 'fixed': 0.29; 'humans': 0.30; 'certainly': 0.32; 'does': 0.32; 'it.': 0.33; 'to:addr:python-list': 0.33; 'header :User-Agent:1': 0.34; 'nobody': 0.34; 'audience.': 0.34; 'pretty': 0.35; 'header:X-Complaints-To:1': 0.35; 'primary': 0.36; 'read,': 0.36; 'offset': 0.37; 'but': 0.37; 'received:org': 0.38; 'amounts': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'your': 0.61; 'free': 0.63; 'ever': 0.65; 'attention.': 0.73; 'processor.': 0.84; 'subject:any': 0.84; 'subject:there': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: is there any principle when writing python function Date: Sat, 27 Aug 2011 15:21:06 -0700 References: <7b47ca17-d3f1-4d91-91d1-98421e8708cd@ea4g2000vbb.googlegroups.com> <87vctitt43.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: <87vctitt43.fsf@benfinney.id.au> 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314483681 news.xs4all.nl 2427 [2001:888:2000:d::a6]:60104 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12308 On 8/27/2011 2:57 PM Ben Finney said... > Emile van Sebille writes: > >> Code is first and foremost written to be executed. > > “Programs must be written for people to read, and only incidentally for > machines to execute.” > —Abelson& Sussman, _Structure and Interpretation of Computer Programs_ > That's certainly self-fulfilling -- code that doesn't execute will need to be read to be understood, and to be fixed so that it does run. Nobody cares about code not intended to be executed. Pretty it up as much as you have free time to do so to enlighten your intended audience. Code that runs from the offset may not ever again need to be read, so the only audience will ever be the processor. I find it much to easy to waste enormous amounts of time prettying up code that works. Pretty it up when it doesn't -- that's the code that needs the attention. Emile > Yes, the primary *function* of the code you write is for it to > eventually execute. But the primary *audience* of the text you type into > your buffer is not the computer, but the humans who will read it. That's > what must be foremost in your mind while writing that text. >