[Python-Dev] Replacement for print in Python 3.0

skip@pobox.com skip at pobox.com
Fri Sep 2 16:59:28 CEST 2005

    Charles> Or the user can just use stdout.write and have full control.

Don't forget that those of us who are arguing in favor of keeping print are
fully aware of stream.write's existence.  It's just that in the common case
the print statement is more convenient.  Maybe a print builtin wouldn't kill
me.  In that case I'd want both output redirection and newline suppression
though.  I guess you'd have to use a keyword arg to specify an alternate
stream.  Perhaps if the last non-keyword argument was exactly one space, the
newline could be suppressed, e.g.:

    print("foo", "bar", "baz", " ", stream=sys.stderr)

That seems a bit like magic, but probably no less magic than the current
trailing comma.


More information about the Python-Dev mailing list