David Bolen wrote:

Jp Calderone <[EMAIL PROTECTED]> writes:

   def nonBlockingReadAll(fileObj):
       bytes = []
       while True:
           b = fileObj.read(1024)
           bytes.append(b)
           if len(b) < 1024:
               break
       return ''.join(bytes)

Wouldn't this still block if the input just happened to end at a
multiple of the read size (1024)?

-- David

No, it'll read up to 1024 bytes or as much as it can, and
then return an apropriatly sized string.
--
Gustavo CÃrdova Avila <[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]>
*Tel:* +52 (81) 8130-1919 ext. 127
Integraciones del Norte, S.A. de C.V.
Padua #6047, Colonia SatÃlite Acueducto
Monterrey, Nuevo LeÃn, MÃxico.

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to