Newbie question involving buffered input

Caolan caolan at ldmf.net
Fri Sep 1 14:41:57 EDT 2006


That makes sense I suppose - why is there a stdin.flush() method then?

________________________________

From: python-list-bounces+caolan=ldmf.net at python.org on behalf of Jean-Paul Calderone
Sent: Fri 9/1/2006 9:53 AM
To: python-list at python.org
Subject: Re: Newbie question involving buffered input



On Fri, 1 Sep 2006 09:31:11 -0700, Caolan <caolan at ldmf.net> wrote:
>I am executing the code below on a Windows XP system and if I enter > 2 characters it buffers the input and the call to sys.stdin.flush does not flush the input, it remains buffered.

You cannot flush input.  The flush method only relates to output.  The
*other* side of the file has to flush *its* output in order for you to
see it as input.

On Linux, the termios module provides a way to tell the system not to do
any buffering on a file descriptor.  pywin32 may expose equivalent
functionality for Windows.

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060901/0b8aa5ca/attachment.html>


More information about the Python-list mailing list