[Idle-dev] IDLE doc addition: print speed & workaround

Terry Reedy tjreedy at udel.edu
Sun Feb 21 17:42:56 EST 2021


https://stackoverflow.com/questions/66286367/why-is-my-function-faster-than-pythons-print-function-in-idle

The question and my answer reports experiment on why IDLE print speed is 
sometimes slow and how to make it faster.

https://github.com/python/cpython/pull/24615
proposes to add the following to the IDLE doc.

Sending print output from one process to a text widget in another is 
slower than printing to a system terminal in the same process.  This has 
the most effect when printing multiple arguments, as the string for each 
argument, each
separator, the newline are sent separately.  For development, this is 
usually not a problem, but if one wants to print faster in IDLE, format 
and join together everything one wants displayed together and then print 
a single string.  Both format strings and ``separator.join`` can help 
combine fields and lines.

I plan to wait a couple of days for comments before merging.

-- 
Terry Jan Reedy



More information about the IDLE-dev mailing list