print statement and multithreading

Paul Duffin pduffin at hursley.ibm.com
Wed Aug 23 06:08:00 EDT 2000


Alex Martelli wrote:
> 
> "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).
> 

How can you tell from Python whether it is supported or not ?
What is the alternative for those cases where it is not supported ?
Why doesn't Python emulate this on those systems which don't support setvbuf ?



More information about the Python-list mailing list