Select in Python

K.S.Sreeram sreeram at tachyontech.net
Tue Jun 27 02:17:37 EDT 2006


Dio wrote:
> while 1:
>     (rr, wr, er) = select([stdin], [], [])
>     for fd in rr:
>         print fd
> 
> program block in the first select(), after I type something and "enter
> ", it never block in select() again,why?

select blocks until there is some data to read from stdin, but it does
not *clear* the data. so once you enter data, select will not block
until you read the data. once you're done reading the available data,
you can again use select to block until more data is available.

Regards
Sreeram


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20060627/8dd4e0fb/attachment.sig>


More information about the Python-list mailing list