3 ms·
I realize that I tend to do that by default in my shell scripts. After a few years of Python, I always make a main() function which gets the command line parame
by mercurial 13y ago
I realize that I tend to do that by default in my shell scripts. After a few years of Python, I always make a main() function which gets the command line parameters. Is this weird?
- eropple 13y agoNot really weird - it allows for more composability if you ever need to go that way.
- mercurial 13y agoI think I do that to avoid global variables as much as possible, as well. Declaring things as "local" tends to keep me honest, as opposed to having a bunch of junk cluttering the global namespace.
- pdpi 13y agoIf you're weird, I'm weird too. It just seems to me that the main should worry about interfacing with the outside world, and the rest of your code should really just be written as a library.
- mercurial 13y agoYes, my main usually does little more than argument handling.