[Python-3000] print() parameters in py3k

Georg Brandl g.brandl at gmx.net
Mon Nov 20 20:42:28 CET 2006


Jim Jewett wrote:
> On 11/19/06, Guido van Rossum <guido at python.org> wrote:
>> On 11/19/06, Georg Brandl <g.brandl at gmx.net> wrote:
>> > Guido van Rossum wrote:
> 
>> > > 2. A keyword parameter will direct it to a different file.
>> > > Probably print(x, y, z, file=<file-like object>).
> 
>> > > 3. Two more keyword parameters can change what gets inserted between
>> > > items and at the end.
>> > > Perhaps print(x, y, z, sep=<string>, end=<string>). These default to "
>> > > " and "\n", respectively.
> 
>> A PEP may also discourage attempts to add more cruft,
> 
> (1)  Is this an explicit rejection of a keyword for a format string, such as
> 
>     print (x, y, z, fmt="My X: %s, Your Y: %s, His Z: %s")

-1. This is confusing, as normally the format string comes first, and then
the arguments to be formatted.

> (2)  What happens to additional keyword arguments that do get passed?
>     (a)  A StandardError of some sort is raised.

Why not the standard TypeError: "xyz" is an invalid keyword arg for this function?

>     (b)  print is treated as though it had (but ignored) a **kwargs
> argument, to support extensions in print-replacements.
>     (c)  The extra arguments are printed at the end, perhaps with a label.

What label do you have in mind?

Georg



More information about the Python-3000 mailing list