[Python-Dev] Replacement for print in Python 3.0

Guido van Rossum guido at python.org
Tue Sep 6 06:56:34 CEST 2005

On 9/5/05, Barry Warsaw <barry at python.org> wrote:
> Eliminating the newline argument from print() would reduce the number of
> reserved keyword arguments in my strawman by half.  Maybe we could even
> rename 'to' to '__to__' (!) to eliminate the other namespace wart.  Is
> this really too horrible:
> print('$user forgot to frobnicate the $file!\n',
>       user=username, file=file.name, __to__=sys.stderr)

Yes, it is too horrible. As I said in another post, __xyzzy__ screams
"special internal use, don't mess with this".

I don't think the namespace wart is really a problem though; it's
simple enough *not* to use 'to' as a variable name in the format.

Didn't you mean printf()? (Though I think if the format string doesn't
roughly follow C's format string conventions the function shouldn't be
called printf().)

What do you think of the trick (that I wasn't aware of before) used in
Java and .net of putting an optional position specifier in the format,
and using positional arguments? It would be a little less verbose and
with sensible defaults wouldn't quite punish everybody as much for the
needs of i18n. Formats with more than 3 or 4 variables should be rare
in any case (these are not the days of Fortran formatted output).

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list