J
Jabba Laci
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
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