Reducing cache/buffer for faster display

Chris Angelico rosuav at gmail.com
Thu Sep 27 18:38:29 EDT 2012


On Fri, Sep 28, 2012 at 8:25 AM, John Gordon <gordon at panix.com> wrote:
> Isn't terminal output line-buffered?  I don't understand why there would
> be an output delay.  (Unless the "\r" is messing things up...)

This is a classic progress-indication case, which does indeed mess up
line-buffering. The carriage return (and no line feed, done in the
Python 2 style of a trailing comma) puts the cursor back to the
beginning of the line, ready to overwrite, and ripe for one of those
old favorite incomplete overwrite errors - if nFiles monotonically
increases, it's fine, but if it decreases, the display can get ugly.

ChrisA



More information about the Python-list mailing list