[Python-Dev] PEP 259: Omit printing newline after newline

Thomas Wouters thomas@xs4all.net
Tue, 12 Jun 2001 10:33:30 +0200

On Tue, Jun 12, 2001 at 03:29:02AM -0400, Tim Peters wrote:
> [/F]
> > when was this discussed on python-dev?

> It wasn't -- it actually came up on one of the SourceForge mailing lists ...

> I'm guessing it's the python-iterators list.

I'm guessing the same thing, because I *did* see the proposal somewhere. I
recall thinking 'that might work' but not much else, anyway.

> The notion that legions of people are using
>     print line
> as an obscure way to get double-spacing is taking me by surprise.

Bah, humbug! (And you can quote me on that.) Backward compatibility is not
an issue -- that's why we have future-imports and warning mechanisms. Import
smart-print from future to get the new behaviour, and warn whenever print
*would* *have* printed one newline less otherwise.

Regardless, I'm -1 on this change. Not because of backward compatibility
problem, but because of what GregE said. Let's not make print even more
magically unpredictably confusing than it already is, with comma's that do
something magical, softspace to control that magic, and shifting the print
operator to the right :-)

Why can't we use

  for line in file:
    print line,

to print all lines in a file ? Softspace doesn't seem to add a space (though
I had to write a testcase to make sure ;) and 'explicit is better than
implicit'. I'd also prefer special syntax to control the softspace
behaviour, like say:

print "spam:", "ham" : "and" : "eggs"

to print 'spamandeggs' without a space inbetween. Too late for that, I
'spose :)

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!