[Python-Dev] PEP 259: Omit printing newline after newline
Alex Martelli
aleaxit at yahoo.com
Tue Jun 12 10:06:08 EDT 2001
"Brian E Gallew" <geek+ at andrew.cmu.edu> wrote in message
news:200106121320.f5CDKCvM032104 at smtp5.andrew.cmu.edu...
...
> I really like Alex's output() (or whatever you want to call it)
> function and would use it in a heartbeat. I would also be much more
> interested in being able to supply a keyword argument to readlines()
> that would have it strip the EOL character(s).
An interesting idea would be (yeah, yeah, I know -- my name
is Alex, and I am an overgeneralizer) to have a named parameter
ln uniformly accepted by all functions and methods dealing
with lines. Default would be ln=1 for functions & methods
that now respect/don't add newlines (readline, readlines,
write, writelines, xreadlines, ...), ln=0 for those that
now generally add/remove newlines (print -- or rather its
function-equivalent -- say 'output', raw_input). Being
"everywhere" would make it easy indeed to teach to newbies.
Being a keyword argument would make life easy for advanced
users, as suggested in my last post, i.e. rather than
if somecondition():
print blah, bloh,
else:
print blah, bloh
or
print blah, bloh,
if somecondition():
print
just
output(blah, bloh, ln=
somecondition())
...
Akex
More information about the Python-list
mailing list