[Python-Dev] extended print statement, uPre-PEP
Barry A. Warsaw
bwarsaw@beopen.com
Sun, 23 Jul 2000 03:07:18 -0400 (EDT)
>>>>> "PP" == Paul Prescod <paul@prescod.net> writes:
PP> I don't see what proposal you are promoting that doesn't have
PP> "@" in it?
Forget about @, let's use >> instead. What I mean by "red herring" is
that it doesn't much matter what the token after print is -- we can
argue about that all we want later. As long as the token can't appear
in that position with any other meaningful semantics, you're fine.
I've got a very rough set of patches that implement this, and here's
an example that really works. I'll flesh the patches out and post
them to SF.
-Barry
-------------------- snip snip --------------------print.py
import sys
from StringIO import StringIO
listname = 'mylist'
sender = 'barry@beopen.com'
msg = 'x' * 1000
print 'post to', listname, 'from', sender, 'size=', len(msg)
print >> sys.stdout, 'post to', listname, 'from', sender, 'size=', len(msg)
log = StringIO()
print >> log, 'post to', listname, 'from', sender, 'size=', len(msg)
print log.getvalue(),
-------------------- snip snip --------------------
% ./python /tmp/print.py
post to mylist from barry@beopen.com size= 1000
post to mylist from barry@beopen.com size= 1000
post to mylist from barry@beopen.com size= 1000