[Python-Dev] Replacement for print in Python 3.0

Terry Reedy tjreedy at udel.edu
Mon Sep 5 01:25:23 CEST 2005

"Guido van Rossum" <guido at python.org> wrote in message 
news:ca471dc20509040859441cc1dc at mail.gmail.com...
> Summarizing, my main problems with print as a statement are the
> transformations -- when print doesn't cut it, you have to switch to
> something entirely different. If it were a function the switch would
> feel much smoother. I find that important: things that are
> conceptually related should be syntactically related (within the realm
> of common sense, as always).

Letting go of my attachment to the status quo, I see a couple of reasons to 
make print syntactically a function that I had not noticed before.

1. In C, for instance, *all* I/O is done with functions.  In Python, 
*almost all* I/O constructs are functions, but with one exception.  This 
makes the language slightly harder to learn.  Many newbies
expect uniformity and many have posted code treating print as a function by 
adding the currently unneeded parentheses.  They have to be taught the 

2. I/O constructs carry with them assumptions about the environment or 
peripherals of the computatonal entity.  Print, in particular, assumes the 
presence of a special default character display device (ok, a stdout char 
stream).  Making print a syntax contruct builds that assumption into the 
syntax.  That violates separation of concern principles and makes Python 
slightly harder to port to systems for which that assumption is not true 
and for which 'print' might even be meaningless.

So I disagree that printing lines of text is fundamental to computation as 
such.  It is certainly no more fundamental than input.  And I notice that 
no one has suggested that (raw)input should be turned into a statement ;-).

Terry J. Reedy

More information about the Python-Dev mailing list