[Python-Dev] Replacement for print in Python 3.0
Paul Moore
p.f.moore at gmail.com
Sat Sep 3 01:17:11 CEST 2005
On 9/2/05, Steven Bethard <steven.bethard at gmail.com> wrote:
> Paul Moore wrote:
> > Interestingly enough, the other languages I use most (C, Java,
> > VB(Script) and Javascript (under Windows Scripting Host)) all use
> > functions for output. Except for C, I uniformly dislike the resulting
> > code - the output structure gets hopelessly lost under the weight of
> > string concatenation and explicitly added spaces.
>
> Are your complaints about Guido's proposal or mine? The complaint
> above doesn't quite seem relevant to my proposal, which retains the
> space-insertion. Basically, my proposal suggests that files (and
> other streams) gain a print method
[...]
Mainly Guido's, I guess. As you point out, your pint method is pretty
close to the print statement. Some comments, though:
1. The print statement applies to *all* streams, where a print method
won't. (You can't ensure that all 3rd-party file-like objects will be
updated, unfortunately...) [A mildly obscure example - the Vim
interface to Python binds sys.stdout to a pseudo stream which puts
output in Vim's message area. Fail to update that code, and the print
builtin won't work in Vim...]
2. There are still a confusing number of methods/builtins involved.
Your print method isn't enough by itself, you still need write (and
presumably a write builtin). Would you reject Guido's writeln? What
about writef (again, as proposed by Guido)? I'm not at all clear
precisely how many new methods and builtins you are proposing.
3. I am still hoping that someone will articulate a clear benefit for
removing the print statement. Without that, I still see all cost and
no benefit (even if I accept that your print function is an entirely
adequate replacement for the print statement, that doesn't count as a
benefit, just as the avoidance of yet another cost...)
Paul.
More information about the Python-Dev
mailing list