print(....,file=sys.stderr) buffered?

Ramchandra Apte maniandram01 at gmail.com
Mon Aug 13 11:25:27 EDT 2012


As far as I know,
stdout is usually buffered (not necessary) in both C++ and Python
stderr is non-buffered in both C++ and Python (I can't imagine the point of
stderr if it were buffered)
Even with this, stdout usually come immediately - the situation you have
shouldn't happen.
Are you using an IDE? If so, which one?

On 13 August 2012 20:46, Helmut Jarausch <jarausch at skynet.be> wrote:

> Hi,
>
> for tracing purposes I have added some print outs like
>
> print('+++ before calling foo',file=sys.stderr)
> x=foo(..)
> print('--- after  calling foo',
>
> and within 'foo'
> print('>>> entering foo ...',file=sys.stderr)
>
> Now, when executing this, I always get
>
> +++ before calling foo
> --- after  calling foo
> >>> entering foo ...
>
> When outputting to stderr from C/C++ it's guaranteed that the different
> outputs appear in the same order as they have been generated.
>
> Is this guarantee no more valid in Python 3.2 ?
>
> Many thanks for a comment,
> Helmut.
>
> (That's a single-threaded application)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120813/973c16f1/attachment.html>


More information about the Python-list mailing list