Old Man Yells At Cloud
Roel Schroeven
roel at roelschroeven.net
Mon Sep 18 15:56:16 EDT 2017
Steve D'Aprano schreef op 17/09/2017 20:49:
> On Mon, 18 Sep 2017 04:09 am, Tim Chase wrote:
> So, you don't like the extra parentheses with print. But you don't mind the
> parentheses in sys.stderr.write (16 chars, versus five for print) or having to
> manually concatenate the strings and manually add a newline at the end. Because
> apparently using print and sys.stderr.write is simpler than print with parens.
Actually I think Tim has a point. I did the same in Python 2: use simple
easy-to-use `print` for the simple cases, and `sys.stdout.write()` or
sometimes `sys.stderr.write()` when simple `print` wasn't enough.
I do prefer Python 3's print-as-a-function because "special cases aren't
special enough to break the rules", but I feel there's a case to be made
for Python 2's print-as-a-statement because "(although) practicality
beats purity" sometimes.
--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov
Roel Schroeven
More information about the Python-list
mailing list