Is output buffering enabled by default in Python's interpreter for sys.stdout
?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
-u
command line switchsys.stdout
in an object that flushes after every writePYTHONUNBUFFERED
env varsys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
Is there any other way to set some global flag in sys
/sys.stdout
programmatically during execution?
If you just want to flush after a specific write using print
, see How can I flush the output of the print function?.