| Store | Cart

"print" as function not statement

From: Aahz <a...@pythoncraft.com>
10 Mar 2004 05:43:22 -0500
In article <mailman.107.1078707454.19534.python-list at python.org>,
Paul Prescod  <paul at prescod.net> wrote:
>>This is just a trial balloon. It isn't even in proper PEP format yet. >Don't take it too personally!

Your arguments are persuasive, but I disagree with your conclusions.
Given that almost every programming language has something like "print"
built into it, we can't afford to drop that name.  I think you need to
find a path that permits mutation from a reserved word.

The other issue is that you're wrong to make print() a function.
Instead, it should be a callable object.  That way, the default print
object has state:

    print(a, b, c)
    print(a, b, c)
    print(x, y, z)
    print("The value is: ", 3)

>	Debug-useful return value>>		As a convenience, if the show function is passed a>		single object to show, it returns that object. If>		it is passed more then one, it returns them as a>		tuple. This can be very convenient in debugging>		contexts. 

I'm in agreement with the person who said that this would be too
confusing in interactive mode.  Then again, if print is an object, it'd
be easy to set this behavior, too.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python

Recent Messages in this Thread
Mark Kamikaze Hughes Mar 08, 2004 01:36 am
John Roth Mar 08, 2004 02:38 am
Leif K-Brooks Mar 08, 2004 07:32 am
Duncan Booth Mar 08, 2004 08:31 am
Leif K-Brooks Mar 08, 2004 10:36 am
A.M. Kuchling Mar 08, 2004 01:29 pm
Heather Coppersmith Mar 08, 2004 12:56 pm
David MacQuigg Mar 09, 2004 09:04 pm
Aahz Mar 10, 2004 10:43 am
Peter Otten Mar 10, 2004 12:52 pm
David MacQuigg Mar 10, 2004 03:32 pm
Messages in this thread