[Python-Dev] Replacement for print in Python 3.0

Fredrik Johansson fredrik.johansson at gmail.com
Thu Sep 1 18:33:18 CEST 2005


I like the present print statement because parentheses are
inconvenient to type compared to lowercase letters, and it looks less
cluttered without them. The parentheses in writeln("hello world")
don't add any more meaning than a terminating semicolon would, so why
are they necessary?

Why not instead change the language so as to allow any function call
to be written without parentheses (when this is unambiguous)? This
could make Python more convenient for creating imperative-style DSLs
(though I'm not sure this is a goal).

In any case, I think "write" would be better than "print", because it
is easier to type (at least for me; reaching for 'w' and than 'r' goes
much faster than reaching for 'p'). I don't like "writeln" though, as
in 9 of 10 cases I want the line break to be there. I'd rather have
write add the line break, and "writeraw" or somesuch exclude it.

By the way, if print has to go, then what about the assert, raise, and
import statements? Should these be changed to use function call syntax
as well? (By the way, assert and raise could be methods:
ZeroDivisionError.assert(denom != 0). Surprising that Java doesn't do
this ;-)

Fredrik


More information about the Python-Dev mailing list