[Python-Dev] Replacement for print in Python 3.0

Paul Moore p.f.moore at gmail.com
Thu Sep 1 18:03:55 CEST 2005


On 9/1/05, Barry Warsaw <barry at python.org> wrote:
> On Thu, 2005-09-01 at 10:58, Guido van Rossum wrote:
> 
> > [Reinhold Birkenfeld]
> > > You'd have to enclose print arguments in parentheses. Of course, the "trailing
> > > comma" form would be lost.
> >
> > And good riddance! The print statement harks back to ABC and even
> > (unvisual) Basic. Out with it!
> 
> I have to strongly disagree.  The print statement is simple, easy to
> understand, and easy to use.

I agree with Barry. In particular, the behaviour of adding spaces
between items is something I find very useful, and it's missing from
the functional forms.

    print greeting, name

feels much more natural to me than

    write(greeting, " ", name)
or
    writef("%s %s", greeting, name)

And that's even worse if the original used a literal "Hello", and only
later migrated to a variable greeting - remembering to get the spaces
in the right place is a pain:

    print "Hello", name  ==> print greeting, name
    write("Hello ", name) ==> write(greeting, name) # oops, forgot the space
or                               write(greeting, " ", name) #
non-obvious translation

OK, it's a minor thing, but what's the benefit?

I've used print functions a lot in things like VBScript and
Javascript, and hated them every time...

Paul.


More information about the Python-Dev mailing list