On 17/09/2017 02:09, Steve D'Aprano wrote:
On Sun, 17 Sep 2017 04:00 am, Stefan Ram wrote:

Steve D'Aprano <steve+pyt...@pearwood.info> writes:
"Hi, I've been programming in Python for what seems like days now, and here's
all the things that you guys are doing wrong.

   I never ever have written a line of Python 2. I started with
   Python 3.6.0. Yet a very frequent mistake of mine is the
   imission of parentheses after »print«.

That's remarkable.

Do you also forget the parentheses around `len`, and `iter`, and `math.sin()`?
If not, what's so special about print?

It was thought of as a statement or command, not a function where you you give it one value and it returns another.

print() is used for its side-effects; what relevant value does it return?

print can also be used for debugging, when it might be written, deleted and added again hundreds of times. So writing all those brackets becomes irksome. 'print' needs to be easy to write.

Javascript (at least the Rhino interpreter, if not others) includes a print
function. It too requires parentheses:

js> print 21
js: "<stdin>", line 5: missing ; before statement
js: print 21
js: .......^
js> print(21)

Javascript I believe uses C-like syntax. C syntax is also fond of unnecessary punctuation, and its 'printf' requires a format string full of format codes. Even more of a nuisance.

--
bartc
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to