title: print() vs sys.stdout.write(): which and why?
body: <p>I have a script that creates output with <code>sys.stdout.write()</code> and <code>sys.stderr.write()</code>. Recently I've posted a couple questions about other aspects of the script and I've noticed that people posting answers seem to prefer <code>print('some text', file=sys.stdout)</code>. My primary concern with the output is simply that it can be piped by the shell, either into a file or as input to another program. Can someone please explain (or direct me to an existing explanation) the differences between <code>print()</code> and <code>sys.stdout.write</code>, the cases in which each should be used and the rational for those conventions?</p>