Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4586

Re: vertical ordering of functions

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!news-transit.tcx.org.uk!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'wed,': 0.04; 'definitions': 0.07; 'whichever': 0.07; 'from:addr:python': 0.09; 'term,': 0.09; 'am,': 0.14; 'wrote:': 0.14; 'defined': 0.15; 'bottom.': 0.16; 'definition,': 0.16; 'definition.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'namespace.': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply-to:addr:python-list': 0.16; 'ties': 0.16; 'classes,': 0.19; 'functions,': 0.19; 'header:In- Reply-To:1': 0.22; 'received:84': 0.25; 'says': 0.25; 'define': 0.26; "i'm": 0.26; 'chris': 0.27; 'function': 0.27; 'hi,': 0.29; 'effect': 0.29; 'class': 0.29; 'does': 0.31; 'called': 0.32; 'to:addr:python-list': 0.32; 'creates': 0.33; 'header:User- Agent:1': 0.35; 'reply-to:addr:python.org': 0.35; 'think': 0.36; 'should': 0.37; 'but': 0.38; 'to:addr:python.org': 0.39; 'would': 0.40; "it's": 0.40; '2011': 0.62; 'below': 0.63; 'entitled': 0.64; 'below.': 0.64; 'remember': 0.65; 'flow': 0.69; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'best!': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AmwHAEWFwE3Unw4S/2dsb2JhbACYSo1Wd8V9hgIEkzKEDIYN
Date Tue, 03 May 2011 23:46:59 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version 1.0
To python-list@python.org
Subject Re: vertical ordering of functions
References <BANLkTinuFqsVEroQH6Tm=Q1r8UGxZFBGpQ@mail.gmail.com> <BANLkTi==eNrKxq=wwewaV-iAdYgJ_sQBSg@mail.gmail.com>
In-Reply-To <BANLkTi==eNrKxq=wwewaV-iAdYgJ_sQBSg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1132.1304462821.9059.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 82.94.164.166
X-Trace 1304462821 news.xs4all.nl 41113 [::ffff:82.94.164.166]:33810
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4586

Show key headers only | View raw


On 03/05/2011 23:31, Chris Angelico wrote:
> On Wed, May 4, 2011 at 8:08 AM, Jabba Laci<jabba.laci@gmail.com>  wrote:
>> Hi,
>>
>> I'm just reading Robert M. Martin's book entitled "Clean Code". In Ch.
>> 5 he says that a function that is called should be below a function
>> that does the calling. This creates a nice flow down from top to
>> bottom.
>
> I prefer to define my terms before I use them. Classes, functions, etc
> get defined at the top and called down below. It's a stylistic thing,
> but it ties in with what you would do in a debate or scholarly
> document; and if you're skimming such a document and you don't
> understand a term, you know to scan upwards for its definition.
>
> It's just a stylistic thing, you can do it whichever way you think best!
>
You also need to remember that in Python, function and class
definitions are _not_ declarations, but statements which have the
effect of adding a name to the namespace.

If you try to call a function before the flow of control has seen the
function definition, you'll get a NameError.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: vertical ordering of functions MRAB <python@mrabarnett.plus.com> - 2011-05-03 23:46 +0100

csiph-web