[Python-Dev] Replacement for print in Python 3.0

Michael Chermside mcherm at mcherm.com
Tue Sep 6 20:45:23 CEST 2005


Please bear with me if this has already been stated, or if I ought to
be directing this to the wiki instead of to python-dev at this point.
I've been trying to follow this whole discussion but have only gotten
as far as last Saturday.

Two things: First of all, I wanted to encourage Guido. There have
been lots of people objecting to "fixing" the print statement, but
I for one agree that it's a wart which should be addressed if it
can be done elegantly. I'm just not speaking up because others
(particularly Guido) have already said most of what I am thinking
and I don't want to clutter the discussion with "me too!"'s.

And one thing which (as far as I've read) _IS_ a new suggestion.
I agree that a new built-in function ought to be named 'print'.
This poses problems for those who want to write code NOW that runs
in Python 2.x (for large values of x) which will also run in 3.0.
We could satisfy both people if in Python 2.x we introduced a
built-in function named "print30" (for Python 3.0) with the intended
new behavior. People could start coding now using the "print30"
builtin. When Python 3.0 was released, 'print' would no longer be
a keyword, and both 'print' and 'print30' would be built-ins that
both refered to the same function. Sure, it's a tiny bit of
backward compatibility cruft to have a second name for the builtin,
but it may be worth it because the ability to write in the "Python
3.0 style" (all new-style classes, only raise proper exceptions,
etc) in the 2.x series is a VERY useful feature. We want to handle
the transition better than Perl.

-- Michael Chermside



More information about the Python-Dev mailing list