[Nick Coghlan] > "Print as statement" => printing sequences nicely is a pain
What's wrong with this? >>> print range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> print tuple("string") ('s', 't', 'r', 'i', 'n', 'g') This is a serious question - that's how I would expect a print function to work anyway. > "Print as statement" => can't easily change the separator [etc] To me, the point of the builtin print is that it's simple. If you want to control what separator is used, or if there is a newline at the end, or print to something that isn't sys.stdout, or some other magic, then use sys.stdout.write(). If you want to get the contents of __unicode__/__str__ of an object to stdout, which there has been overwhelming evidence is a very common task, then print is a fantastically simple and straightforward way to do that. [Terry Reedy] > For quickly adding debug prints, two extra ()s are a small burden, > but if the function were called 'out', then there would still be just five > keystrokes. But seven keypresses (assuming one is using a keyboard where you use shift to get '(' and ')'). It sounds trivial, but a print statement (i.e. no ()) looks clean and concise. I like this: while True: pass More than: while (true) {} For the same reason. This is a big plus of Python vs. C. [Guido] > Consider this: if Python *didn't* have a print statement, but > it had a built-in function with the same functionality > (including, say, keyword parameters to suppress the trailing > newline or the space between items); would anyone support a > proposal to make it a statement instead? Yes. If it didn't have the redirect stuff; I would like it more if it also didn't have the trailing comma magic. "print" is a fundamental; it deserves to be a statement :) =Tony.Meyer _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com