I prefer using partial than introducing new syntax: print_to_stderr = functools.partial(print, file=sys.stderr) print_to_stderr('first line') print_to_stderr('second line') ... - Tal On Thu, Mar 13, 2008 at 10: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? _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas