Old Man Yells At Cloud
On Mon, 18 Sep 2017 04:09 am, Tim Chase wrote:
> On 2017-09-18 00:42, Steve D'Aprano wrote:
>> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
>> Presumably you've never wanted to print to something other than
>> std.out. The syntax in Python 2 is horrid:
>> print >>sys.stderr, args
> For those cases, the old syntax was sufficiently horrid that indeed I
> didn't use it, but rather used
> print "Normal output"
> sys.stderr.write("error output!\n")
> Yes, adding the \n manually is a minor annoyance, but it wasn't much
> of an issue.
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.
> That said, I'm neither here nor there when it comes to using
> print-as-a-statement vs print-as-a-function. I like the consistency
> it brings to the language, but miss the simplicity that Py2 had for
> new users.
What simplicity? It adds complexity, not simplicity: do you need brackets or
not? Why is print special? When do I use print and when do I use
sys.stdout.write? Decisions decisions.
print(len mylist, "items in the list")
> I'd almost want to get it back as a feature of the REPL,
Oh yes, that's an excellent idea: make it even harder for beginners to learn
when they do and don't need parentheses :-(
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.