vertical ordering of functions

Jabba Laci jabba.laci at gmail.com
Tue May 3 18:08:27 EDT 2011


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



More information about the Python-list mailing list