This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wojtekwalczak
Recipients wojtekwalczak
Date 2007-11-07.18:36:10
SpamBayes Score 0.0011314198
Marked as misclassified No
Message-id <>
py3k's print() is not flushing when the string's length is 1 byte long 
and 'end' parameter is set to ''. Example:
>>> print('x',end='') # it should print 'x' but it does nothing
>>> print('') # we have to call second print() to get buffers flushed

The same thing happens when the string is empty and end's length is 1:
>>> print('',end='x') # it should print 'x' but it does nothing
>>> print('') # we have to call second print() to get buffers flushed

When there is more characters than one, print() is flushing allright 
(despite of lack of a newline in the interpreter):
>>> print('x',end='y')
xy>>> print('xx',end='')
xx>>> print('',end='yy')
The same thing happens in scripts. Try this one as script:
import time


First print() will flush immediately even though there is no newline
and flush is not called, while second print() will flush after second
sleep (because python is flushing buffers at the end of the script).
The conclusion is that print() is not flushing immediately when
string is 1 byte long, but when it is longer - then print() is
flushing even when there is no newline or flush was not called by the 

I guess print() should act in the same way for every string > 0 bytes 
long instead of for every string > 1 byte long.

Any ideas where is the bug?

You can find Python-3000's mail list discussion about that bug here:

Wojtek Walczak
Date User Action Args
2007-11-07 18:36:11wojtekwalczaksetspambayes_score: 0.00113142 -> 0.0011314198
recipients: + wojtekwalczak
2007-11-07 18:36:11wojtekwalczaksetspambayes_score: 0.00113142 -> 0.00113142
messageid: <>
2007-11-07 18:36:11wojtekwalczaklinkissue1400 messages
2007-11-07 18:36:10wojtekwalczakcreate