[Python-Dev] Replacement for print in Python 3.0
Guido van Rossum
guido at python.org
Tue Sep 6 06:46:04 CEST 2005
On 9/5/05, Calvin Spealman <ironfroggy at gmail.com> wrote:
> There is a lot of debate over this issue, obviously. Now, I think
> getting rid of the print statement can lead to ugly code, because a
> write function would be called as an expression, so where we'd once
> have prints on their own lines, that wouldn't be the case anymore, and
> things could get ugly.
Sounds like FUD to me. Lots of functions/methods exist that *could* be
embedded in expressions, and never are. Or if they are, there's
actually a good reason, and then being a mere function (instead of a
statement) would actually be helpful. Anyway, why would it be
important that prints are on their own line where so many other
important actions don't have that privilege?
> But, print is a little too inflexible.
> What about adding a special name __print__, which the print statement
> would call? It should be looked up as a local first, then global.
> Thus, different parts of a program can define their own __print__,
> without changing everyone else's stdout. The Python web people would
> love that.
Too many underscores; __print__ screams "internal use, don't mess" at you.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev