If the output stream is not a terminal (i.e. redirected to a file or another process), it's probably buffered. In most cases it doesn't matter. However, if the output of your program is generated with delays between the lines and you may want to redirect them to another process and immediately see the results (e.g. my_app.py | grep something), it's a good idea to force flushing of the buffer. To do so, set dispatch(..., always_flush=True).
If the output stream is not a terminal (i.e. redirected to a file or another process), it's probably buffered. In most cases it doesn't matter. However, if the output of your program is generated with delays between the lines and you may want to redirect them to another process and immediately see the results (e.g.
my_app.py | grep something
), it's a good idea to force flushing of the buffer. To do so, setdispatch(..., always_flush=True)
.