fluentpython / example-code-2e

Example code for Fluent Python, 2nd edition (O'Reilly 2022)
https://amzn.to/3J48u2J
MIT License
3.17k stars 902 forks source link

19-coroutine/coroaverager3:grouper #15

Closed dongzeXD closed 3 years ago

dongzeXD commented 3 years ago

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

ramalho commented 3 years ago

Thanks for reporting this.

I have moved most content about classic coroutines from the second edition to the companion web site. The former chapter 19 is now at Classic Coroutines, including the example with the issue you have reported.

Accordingly, I have recreated the issue in the site repository: https://github.com/fluentpython/book-site/issues/4.

My priority now is to finish the book, so I will not be able to analyze the issue you reported until I deliver the revised draft. Thanks.