I want my program by default to stdout, but give the option of writing it to a file. Should I create my own print function and call that testing that there is an output file or is there a better way? That seems inefficient to me, but every way I can think of calls an additional if test for every print call. I know this really doesn't matter in the long run probably, at least of this script, but I'm just trying to learn good habits.
I recommend you using the logging module and logging.handlers... stream, output files, etc..
What's the best way to handle output redirection?