Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I still can't get why they replaced: `print "abc"` with `print("abc")`.

Python REPL was my go to shell calculator and it is quite elaborate to put the parentheses around what I would like to print, for me that was the main drawback of python3.

But I don't write production code in python, it is used only for small shell scripts, or like calculator.



Having print as a function instead as a statement provides flexibility and ease of customizing.

Printing to anything but stdout, printing with a separator, using the end keyword, etc, all became easier.


For basic calculations, let me recommend bc to you: https://en.wikipedia.org/wiki/Bc_(programming_language)

This way you don't even have to type "print" ;)


I don't need to type it in python also, unless I do some loops or functions.

I tried bc once and it was too big learning curve for just simple calc that indo in python.


If you use the REPL as a calculator you don't even need print at all! The terminal will automatically print the result of your last statement!

    >>> 5+5
    10


Yes I know that.

But look at my comment above, I use also for loops and functions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: