[Python-Dev] Replacement for print in Python 3.0

Steven Bethard steven.bethard at gmail.com
Thu Sep 1 22:23:28 CEST 2005


[Guido van Rossum]
> And good riddance! The print statement harks back to ABC and even
> (unvisual) Basic. Out with it!

[Barry Warsaw]
> I have to strongly disagree.  The print statement is simple, easy to
> understand, and easy to use.

[Paul Moore]
> 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.

While I agree that mostly the print statement is "simple, easy to
understand, and easy to use", I've seen the trailing-comma version
cause confusion for a lot of newbies.  I wouldn't mind at all if the
trailing-comma version disappeared in Python 3.0 -- if you need this
kind of complicated output, you can always use sys.stdout.write and/or
string formatting.

The spaces-between-items point that Paul Moore makes is IMHO the best
argument against the proposed write*() functions.  I think we *do*
need a statement or function of some sort that does the most basic
task: writing a line to sys.stdout that calls str() on each of the
elements and joins them with spaces.  That is, I think we need to keep
*something* with functionality like:

    def XXX(*args):
        sys.stdout.write('%s\n' % ' '.join(str(a) for a in args))

Note that this would keep the Hello World example simple:

    XXX(greeting, name)

STeVe
-- 
You can wordify anything if you just verb it.
        --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list