[Python-Dev] Replacement for print in Python 3.0
Terry Reedy
tjreedy at udel.edu
Sat Sep 3 05:33:08 CEST 2005
"Guido van Rossum" <guido at python.org> wrote in message
news:ca471dc20509021842e586aa3 at mail.gmail.com...
> With so many people expressing a gut response and not saying what in
> the proposal they don't like, it's hard to even start a response.
> Is it...
For me a bit of several things though with quite variable intensity.
First, print, as an abbreviation of looped writes, works fine for its
appointed task. It gives me don't-care-about-the-format info on values
with near minimal overhead. So change needs clear justification.
> - Going from statement to function?
Minor. For quickly adding debug prints, two extra ()s are a small burden,
but if the function were called 'out', then there would still be just five
keystrokes. Nick's output() convinced me that there are compensations to
the function form. Besides, having used the argument of aesthetic
consistency elsewhere, I can hardly deny it to you ;-).
> - Losing the automatically inserted space?
Major. This is an essential plus of print.
> - Having to write more to get a newline appended?
Near major. See above. I believe that two people have reported that
around 85% of their prints use these defaults, so I think adding a keyword
for something other would be the way to go.
> - Losing the name 'print'?
You gave one reason for this as disassociating from Basic. I can see how a
CS grad would want to do so, but Basic once was the vehicle for CP4E
(computer programming for everyone) that you want Python to become. In
fact, I think PSF should promote Python as the 'Basic for the 21st Century'
that should be on most desktops the way Basic once was. So I would prefer
to see a different reason for a name change.
> - [dash added] Some responses seemed to have missed [snip]
> that I was proposing builtins in addition to the stream methods,
My objections here are first the plural, which does not seem really
necessary, and second the longer (in chars and syllables) and also old
name 'writeln' from Pascal for the one that does what print does.
> I'd like to be flexible on all points *except* the syntax -- I really
> want to get rid of print as a *statement*. [snip]
> would anyone support a proposal to make it a statement instead?
Good question. Most Python statements benefit from statement syntax
because their function syntax equivalent would be a little to hughly more
awkward. This is mainly because parts of the statement are implicitly
quoted. (Lisp does this with special forms and macros, but I prefer the
Python way.) The two syntax tricks in print are different in that they are
easily replaced by keywords. So I strongly suspect 'no'.
Terry J. Reedy
More information about the Python-Dev
mailing list