[Python-3000] print() parameters in py3k

Georg Brandl g.brandl at gmx.net
Sun Nov 19 22:37:06 CET 2006

Guido van Rossum wrote:
> On 11/19/06, James Thiele <python3now at gmail.com> wrote:
>> The BDFL has said that print will change from a statement to a function in
>> Python 3.
>> I haven't found anything describing what parameters it will take and what it
>> will return. Has this been decided?
> Not really, I'm hoping someone would write a PEP. But (from memory, I
> think there are some threads on python-dev or the py3k list about
> this) here are some suggestions:
> 1. With only positional parameters (or none at all), print(x, y, z) is
> equivalent to "print x, y, z" today. So it converts each argument
> using str(), inserting spaces in between, and appending a newline.
> 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.
> 4. The softspace feature (a semi-secret attribute on files currently
> used to tell print whether to insert a space before the first item)
> will be killed.

Do we even need a PEP? This is a good, easy-to-explain interface. Is more
functionality needed?


More information about the Python-3000 mailing list