Guido van Rossum supports simple print. (1991)

Manuel Gutierrez Algaba thor at localhost.localdomain
Sat Sep 2 18:07:54 EDT 2000


Guido vs Guido

No comments, just the plain reasons:

Subject: Why print is a built-in statement
From: Guido van Rossum guido at c...
X-Organization: CWI, Kruislaan 413, 1098 SJ Amsterdam, The Netherlands
X-Phone: +31 20 5924127 (work), +31 20 6225521 (home), +31 20 5924199 (fax)
Date: Sat, 07 Dec 91 15:00:00 +0100
--------
Steven Majewski mentioned one issue that I didn't address yet: why
"print" is built-in in Python.  I'd like to explain this.

One of the reasons is that a simple print statement is useful for
simple programs.  Being a statement it doesn't need parentheses around
its argument list, which saves some typing.

Another reason is that it treats arguments separated by commas
differently than a single argument consisting of a tuple:

        print 'x =', x

might print

        x = 3.14

while

        t = 'x =', x
        print t

would print

        ('x =', 3.14)

(This has to do with the function argument discussion, by the way.)

The third reason has to do with the final linefeed written by print:
again, for simple programs, it's desirable that the simplest form of
print statement prints a complete line; but there also must be a way
to print partial lines.  Using special syntax (a trailing comma) to
specify the alternate behavior seemed preferable over having two
functions like Pascal's write and writeln (especially since it would
have meant two reserved words given the choice for non-function
syntax).

Writing it down makes it all sound like feeble excuses for a real
solution; but everything else I could think of had other
disadvantages.  Perhaps printing is one of these things that are
important enough to warrant more than one way to do things, even in
Python...

--Guido van Rossum, CWI, Amsterdam guido at c...
"*Nobody* expects the Spanish Inquisition"

Well, I'm Spanish... :P

--- 
MGA



More information about the Python-list mailing list