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


Groups > comp.lang.python > #4580

vertical ordering of functions

From Jabba Laci <jabba.laci@gmail.com>
Date 2011-05-03 18:08 -0400
Subject vertical ordering of functions
Newsgroups comp.lang.python
Message-ID <mailman.1127.1304460530.9059.python-list@python.org> (permalink)

Show all headers | View raw


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.
However, when I write a Python script I do just the opposite. I start
with the lines

if __name__ == "__main__":
    main()

Then I add main() above, which is a control function that contains
some function calls that decompose the problem into subproblems. Then
I add these functions above, etc.

Is there a convention for this? Should main() be at the top and called
function below?

Thanks,

Laszlo

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


Thread

vertical ordering of functions Jabba Laci <jabba.laci@gmail.com> - 2011-05-03 18:08 -0400
  Re: vertical ordering of functions Ben Finney <ben+python@benfinney.id.au> - 2011-05-04 09:58 +1000
    Re: vertical ordering of functions John Bokma <john@castleamber.com> - 2011-05-03 19:44 -0500
  Re: vertical ordering of functions Roy Smith <roy@panix.com> - 2011-05-03 20:27 -0400
  Re: vertical ordering of functions Grant Edwards <invalid@invalid.invalid> - 2011-05-04 01:09 +0000
  Re: vertical ordering of functions John Roth <johnroth1@gmail.com> - 2011-05-04 04:14 -0700
  Re: vertical ordering of functions Hans Georg Schaathun <hg@schaathun.net> - 2011-05-10 19:31 +0100

csiph-web