Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Mod : Example 16-17 grouper optimization #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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 deletions 16-coroutine/coroaverager3.py
Original file line number Diff line number Diff 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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy