if STREAM.isatty():
Hongyi Zhao
hongyi.zhao at gmail.com
Thu Aug 29 09:37:01 EDT 2019
On Thu, 29 Aug 2019 13:23:07 +0100, Rhodri James wrote:
> TLDR: these two lines set up (but don't output) a progress message for
> an interactive stream.
Thanks a lot for your deeply notes on this. But, if so, when will the
``else ...'' be executed in the original code:
if STREAM.isatty():
p = (self.progress_template + '\r') % params
else:
current_time = time.time()
if self._last_time == 0.0:
self._last_time = current_time
else:
interval = current_time - self._last_time
if interval < 0.5:
return
self._last_time = current_time
p = (self.progress_template + '\n') % params
STREAM.write(p)
STREAM.flush()
Regards
More information about the Python-list
mailing list