[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Guido van Rossum
Guido van Rossum added the comment: Yeah, that too should just be documented. The read-until-eof behavior is quite entrenched (in fact I had a hard time finding example read calls with a size parameter :-). Specifying a huge buffer size in order to read until EOF isn't really a common practice, b

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Jack O'Connor
Jack O'Connor added the comment: Agreed that changing read() would probably break tons of people. I don't think a naming inconsistency meets the "serious flaws are uncovered" bar for breaking a provisional package. If we actually prefer the asyncio way of doing things, all the better. That sa

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Guido van Rossum
Guido van Rossum added the comment: Loet's just spruce up the docs a bit. (Also maybe fix that awkward sentence in the BufferedReader docs.) -- ___ Python tracker ___ _

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-26 Thread Guido van Rossum
Guido van Rossum added the comment: Also, I'm not too fond of the read1()/read() dichotomy. I was pretty much forced into it because Python 2 streams implemented read() using the libc fread() function, which has this behavior -- but in general I find the UNIX read() syscall more convenient, a

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-26 Thread Guido van Rossum
Guido van Rossum added the comment: Oh, I just checked the docs. io.BufferedIOBase.read(size) is more complicated than I (or Jack) thought -- it can return a short read if the underlying raw stream is "interactive". The subclass io.BufferedReader uses the definition preferred by Jack (though

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-26 Thread STINNER Victor
STINNER Victor added the comment: Guido, what do you mean by changing this? Rename methods? What about the backward compatibility? Is it possible that an application written with the "read1 behaviour" blocks if read(n) waits for exactly n bytes? I like the idea of having the same names in io and

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-26 Thread Guido van Rossum
Guido van Rossum added the comment: Good point. I think I had forgotten how BufferedIOBase worked... :-( I believe we should just change this -- Victor, what do you think? -- ___ Python tracker __

[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-26 Thread Jack O'Connor
New submission from Jack O'Connor: BufferedIOBase and related classes have a read(n) and read1(n). The first will wait until n bytes are available (or EOF), while the second will return as soon as any bytes are available. In asyncio.StreamReader, there is no read1 method, but the read method s