Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(90)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 68800045: drain(�) is a coroutine

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by haypo_gmail
Modified:
11 years, 10 months ago
Reviewers:
GvR
Visibility:
Public.
drain(�) is a coroutine

Patch Set 1 #

Created: 11 years, 10 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -15 lines) Patch
M asyncio/streams.py View 1 chunk +3 lines, -15 lines 0 comments Download
Total messages: 3
|
GvR
Let me think about this. There was something clever about this. I think it was ...
11 years, 10 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.
Sign in to reply to this message.
haypo_gmail
On 2014年02月26日 00:01:08, GvR wrote: > Let me think about this. There was something clever ...
11 years, 10 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.
Sign in to reply to this message.
GvR
What's weird about the common case? You can just write s.write(b'x') yield from s.drain() There's ...
11 years, 10 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.
Sign in to reply to this message.
|
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /