Let me think about this. There was something clever about this. I think it was ...
10 years, 2 months ago
(2014-02-26 00:01:08 UTC)
#1
Let me think about this. There was something clever about this. I think it was
allowing code that would keep writing (without ever yielding) until the buffer
is full, e.g.
while True:
while True:
s.write(b'x')
w = s.drain()
if w:
break
yield from w
But this may be excessively clever.
On 2014/02/26 00:01:08, GvR wrote: > Let me think about this. There was something clever ...
10 years, 2 months ago
(2014-02-26 00:11:37 UTC)
#2
On 2014/02/26 00:01:08, GvR wrote:
> Let me think about this. There was something clever about this. I think it was
> allowing code that would keep writing (without ever yielding) until the buffer
> is full, e.g.
>
> while True:
> while True:
> s.write(b'x')
> w = s.drain()
> if w:
> break
> yield from w
>
> But this may be excessively clever.
It makes the common case look weird. If you consider this use case important
enough, why not adding a method to check if the buffer is full which would
simply return a boolean?
I never had to check if a write buffer is full or not.
What's weird about the common case? You can just write s.write(b'x') yield from s.drain() There's ...
10 years, 2 months ago
(2014-02-26 00:18:04 UTC)
#3
What's weird about the common case? You can just write
s.write(b'x')
yield from s.drain()
There's normally no need to check for drain()'s return value.
Issue 68800045: drain(�) is a coroutine
Created 10 years, 2 months ago by haypo_gmail
Modified 10 years, 2 months ago
Reviewers: GvR
Base URL:
Comments: 0