
On Thu, Mar 13, 2008 at 3:56 PM, Erick Tryzelaar <idadesub@users.sourceforge.net> wrote:
This might be a minor thing, but I kind of wish that I could write this:
sys.stderr.print('first line') sys.stderr.print('another line here') sys.stderr.print('and again')
instead of:
print('first line', file=sys.stderr) print('another line here', file=sys.stderr) print('and again', file=sys.stderr)
As it's a lot easier to read for me. Of course you can always add spaces to make the lines line up, but with a long print statement your eye has to go a long distance to figure out what file, if any, you're printing to. It could be pretty simple to add:
class ...: def print(*args, **kwargs): io.print(file=self, *args, **kwargs)
I haven't been able to find any discussion on this, has this already been rejected?
It was brought up, considered, and rejected. The reason is that it would require *every* stream-like object to implement the print() functionality, which is rather hairy; or subclass a specific base class, which we traditionally haven't required. Making it function that takes a file argument avoids these problems. And, by the way, it's too late to bring up new py3k proposals. -- --Guido van Rossum (home page: http://www.python.org/~guido/)