PEP 259: Omit printing newline after newline

Martijn Faassen m.faassen at vet.uu.nl
Tue Jun 12 19:12:19 EDT 2001


Andrew Kuchling <akuchlin at mems-exchange.org> wrote:
> Guido van Rossum <guido at digicool.com> writes:
>>     I propose to skip printing the newline when it follows a newline
>>     that came from data.

> -1; I'd rather see a strip_trailing_whitespace argument added to
> .readlines(), or some alternative idiom encouraged that sidesteps the
> issue.  Magical behaviour is bad.

'print' seems to attract magical behavior. A widespread idea among
Python developers is not to use print for serious programming; this
is likely because it's too magic already.
 
I grant that some of print's magic is convenient when doing quick and dirty 
stuff. That's how I use it. I guess adding more magic wouldn't really
harm me, but it also seems completely unnecessary.

My favorite thing to do in the current situation is to please leave 'print'
alone. If we want particular behavior we can always use sys.stdout.write()
wrapped in a clear, explicit function that does exactly what we like.

If this is a convenience issue, make a builtin function that does
sys.stdout.write(), if we really can't be bothered to import
sys.

If this is an easier for newbies issue; I think a strong case can be made
that more magic confuses newbies.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list