2007/11/7, Daniel Stutzbach <[EMAIL PROTECTED]>:
> print() shouldn't flush if there isn't a newline, unless the buffer is
> full or the user calls flush().
So the buffer size in py3k is 1 byte long? Try this as a script in py3k:
-----------------
import time
print('xx',end='')
time.sleep(3)
print('x',end='')
time.sleep(3)
-----------------
First print() will flush immediately even though there is no newline
and flush is not called, while second print() will flush after second
sleep.
What I am saying is that print() is not flushing immediately when
string is 1 byte long, but when it is longer - then print() is
flushing immediately. It works that way both for interpreter and
scripts.
> The patch you suggest would cause a flush after *every* write with
> print, which would cause a very significant performance hit on
> programs that do a lot of writing to standard output (especially if
> standard output is a pipe).
No, it is calling flush only when the 'end' in print() is set.
Otherwise (end==NULL or end==Py_None) it just prints newline as it was
doing before. Anyway - I agree that it is a hit for performance and as
I said before, I think that the problem lies somewhere deeper. Any
clues?
Wojciech Walczak
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com