Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Mod : Example 16-17 grouper optimization#5

Open
lbbc1117 wants to merge1 commit intofluentpython:master
base:master
Choose a base branch
Loading
fromlbbc1117:master
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions16-coroutine/coroaverager3.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,8 +63,11 @@ def averager(): # <1>

# the delegating generator
def grouper(results, key): # <5>
while True: # <6>
results[key] = yield from averager() # <7>
# while True: # <6>
results[key] = yield from averager() # <7>
# When group.send(None) is called, group runs to the yield statement below
# without raising StopIteration and creating a useless new instance of averager
yield


# the client code, a.k.a. the caller
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp