Typically, output to a file or console is buffered with text output, at least until you print a new line. A flash ensures that any output that is buffered is sent to its destination.
I use it, for example. when I make a user request, for example Do you want to continue (Y/n): before receiving the input.
This can be modeled (on Ubuntu 12.4 using Python 2.7):
from __future__ import print_function import sys from time import sleep fp = sys.stdout print('Do you want to continue (Y/n): ', end='')
If you run this, you will see that the prompt line is not displayed until the dream ends and the program exits. If you uncomment a line with a flash, you will see a prompt, and then wait 5 seconds for the program to finish
Anthon
source share