News for hackers. Stuff that matters.
Re:Don't Pipe to your Shell by mercurial on Friday November 01, 2013 @03:57AM (#6652416)
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?
Re:Don't Pipe to your Shell by pdpi on Friday November 01, 2013 @07:37AM (#6653007)
If 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.

Re:Don't Pipe to your Shell by mercurial on Saturday November 02, 2013 @02:48AM (#6658411)
Yes, my main usually does little more than argument handling.
Re:Don't Pipe to your Shell by eropple on Friday November 01, 2013 @04:51AM (#6652538)
Not really weird - it allows for more composability if you ever need to go that way.
Re:Don't Pipe to your Shell by mercurial on Friday November 01, 2013 @06:08AM (#6652781)
I 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.