print statement and multithreading

Alex Martelli alex at magenta.com
Tue Aug 22 15:57:10 EDT 2000


"Matthew Schroeder" <MSchroeder at CreativeSolutions.com> wrote in message
news:C17F1AF032ECD21180C100A024BB8E2E0256FD17 at bruiser.creativesol.com...
> that could be, if the IO streams are buffering the output, because they'd
> flush at different times.
>
> In Perl we were able to specify autoflush for the buffers, which would
keep
> them in order, as they wouldn't buffer output then.
>
> I don't know if you can do the same in Python though.

You can run python -u to have output unbuffered.

When you open a file, you can specify a third argument of 0 (buffer
size) to get it unbuffered (but this is documented to work only on
systems which have setvbuf in the underlying C library -- which,
fortunately, should include all ISO-standard C compilers, I think).


Alex






More information about the Python-list mailing list