![]() |
Program layout - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: Program layout (/thread-18301.html) |
Program layout - pfaber11 - May-12-2019 Hi was wanting to know is there a particular way of structuring a python program . For the last year and a half I've been using Basic and am trying to learn python . Been at it about a week and seem to be doing ok. However what I was wondering is how to structure a program like main with multiple subroutines or procedures . As I say I've only been at this a week so any good advice would be welcome . RE: Program layout - micseydel - May-12-2019 Every program is different. A common pattern is to have a main() function from which everything starts, and then invoke it at the end of your script like this: if __name__ == "__main__": main()Global variables are considered bad, and object-oriented programming is often important to the proposed solution. Beyond that, I think you'd get the most out of this question by asking about specific circumstances. RE: Program layout - Yoriz - May-13-2019 https://docs.python-guide.org/writing/structure/ |