PEP 259: Omit printing newline after newline

Stian Husemoen stianh at ifi.uio.no
Tue Jun 12 06:01:27 EDT 2001


[Guido van Rossum]
>I propose to skip printing the newline when it follows a newline
>that came from data.

Gustaf Liljegren wrote:
>I like consistency, so I think either 'print' should add a newline, or it 
>shouldn't. Whatever you choose, it shouldn't do things "behind the scenes". 

I must agree with Gustaf here.. Making decisions like that for the user are
just adding more special cases and confusion.


>If it depends on the line before, it won't be so self-explanatory if you 
>see a 'print' statement with no arguments.

And to qoute the Zen of Python: Explicit is better than implicit.


>If you make rstrip() a built-in function, you get something like chomp() in 
>Perl. :-)

No need to make it a builtin.. We already have string methods. 

If this proposed behavior is really needed, how about adding another magic
operator like '>>' or ',' to the print statement? Then I can go on 
pretending that this new operator doesn't exist either <wink>

-- 

Stian Husemoen <stianh>



More information about the Python-list mailing list