| Store | Cart

"print" as function not statement

From: John Roth <news...@jhrothjr.com>
Sun, 7 Mar 2004 21:38:01 -0500
"Paul Prescod" <paul at prescod.net> wrote in message
news:mailman.107.1078707454.19534.python-list at python.org...
> This is just a trial balloon. It isn't even in proper PEP format yet.> Don't take it too personally!

Why would I take it personally? [grin]

It's an interesting proposal. As far as I'm concerned, the
print statement has two uses:

1. It's a handy way of getting output for debugging, and
2. It's a handy way of producing output for quick,
 one-off scripts.

Also AFAIAC, it has no utility in larger programs; the
<file>.write() method is more than adequate and
provides much better control for normal output;
debug output is better served by the logging module.

The only purpose I can see for a functional form
of the print statement is in your extension suggestion:
a function that would return its (single) parameter
while at the same time printing it out. This could be
quite useful in debugging if you want to provide a
very precise probe without having to rewrite a
statement to get a print in the appropriate place.

I'd suggest putting together a module with your
proposed show() function and publicizing it.

Print is definitely quirky, and I wouldn't be sorry
to see it go.

John Roth

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