[Python-Dev] extended print statement, uPre-PEP

Paul Prescod paul@prescod.net
Sat, 22 Jul 2000 15:13:51 -0500

"Barry A. Warsaw" wrote:
> ...
> Because it's less readable.
> log.write('post to %s from %s, size=%d\n' % (listname, sender, len(msg)))
> vs
> print 'post to', listname, 'from', sender, 'size=', len(msg)

Okay, how about

log.writeln("Post to ", listname, " from ", sender, " size=", len( msg

or (with auto string-coercion):

log.writeln("Post to "+listname+" from "+sender+" size="+len( msg ))

> With the former, you have to know about the rules for string
> interpolation, you have to make sure you've got your tuple is the
> right length, you have to remember to add the trailing newline.

Nevertheless, every Python programmer needs to learn the ".write" way in
order to do reasonable text processing. So print's idiosyncracies are
just one more thing to learn. In the long run, print hurts newbies more
than it helps them because it confuses them into thinking its useful and
then frustrates them when they learn its a hack that always appends
trailing whitespace.

> So my extended print suggestion doesn't add any new keywords or
> operators (forget about `@' specifically -- it's a red herring) and I
> don't think it makes the statement any less readable, and in fact
> improves usability for little extra cognitive or code complexity
> costs.

I don't see what proposal you are promoting that doesn't have "@" in it?

 Paul Prescod - Not encumbered by corporate consensus
New from Computer Associates: "Software that can 'think', sold by 
marketers who choose not to."