[Python-Dev] Replacement for print in Python 3.0
Guido van Rossum
guido at python.org
Fri Sep 9 17:28:15 CEST 2005
On 9/8/05, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Could be. For me, the name "print" is associated with a long history
> of magical behavior that only a human could possibly feel comfortable
> with. One of the great sins of Pascal was tarring the name "write"
> with the same brush!
Well, apart from your personal history, and in the light of future
developments, for most people who aren't programmers using dinosaur
languages, "print" will probably mean "convert a document to bits of
ink on paper" or perhaps by extension into the third dimension
"produce a physical object from a virtual one". (I've seen some
amazing demos of the latter at foocamp, even though the equipment is
still a bit big to fit in a typical kitchen. :)
While I laugh at the naive view of people who write things like
"Interface equality and neutrality would be a good thing in the
language" and seriously (? I didn't see a smiley) use this argument to
plead for not making print() a built-in, I do think that avoiding the
'print' name would be a good thing if it could be done without ticking
off the old-timers.
On the third hand, I notice that Java uses read()/write() and class
names ending in Stream for a byte-oriented API, and print()/println()
with class names ending in Reader/Writer for a text/character-based
API. (Some classes provide both print() and write() methods and there
the distinction is clearest.) Since Python 3000 is heading in the same
direction, I wouldn't mind having some API distinction so it's clearer
to the reader whether we are writing binary or or text data.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev