Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19-coroutine/coroaverager3:grouper #4

Open
ramalho opened this issue Aug 26, 2021 · 0 comments
Open

19-coroutine/coroaverager3:grouper #4

ramalho opened this issue Aug 26, 2021 · 0 comments

Comments

@ramalho
Copy link
Member

ramalho commented Aug 26, 2021

Issue originally reported by @dongzeXD at fluentpython/example-code-2e#15, related to an example in post Classic Coroutines:


In <6> annotations :"Each iteration in thisloop creates a new instance of averager; each is a generator object operating as a coroutine." and <7>:"Whenever grouper is sent a value, it’s piped ..., the value it returns is bound to results[key]. The while loop then proceeds to create another averager instance to consume more values."

Would I replace while True with yield?
This seems easier to understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant