In chapter one, a reviewer had this two-word question:
"yield from?"
What? What does "yield from" mean?
Oh.
Wow.
https://docs.python.org/3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator
I had utterly missed this profound, important feature.
I guess I have been too blasé in skimming the release notes.
That's embarrassing. And it only took two words to reveal my mistake.
I had to then review all 113 yield statements in 72 files of examples that go with the book. That means most chapters will get touched to revise an example to show yield from iter instead of the older for x in iter: yield x template.
This also changes the Tail Call Optimization material. The explicit for was actually kind of nice for showing how TCO is implemented in Python. The yield from makes it a little less clear.
Some reviewers consider TCO so fundamental that it belongs in chapter 1. The omission of detailed analysis of Python's TCO approach was considered a significant flaw. Other reviewers seemed happy setting discussion of TCO aside for later.
The Functional Python Conundrum
One reviewer asked -- in effect -- why would someone who knew functional LISP ever use Python? I don't think there's a big audience of disgruntled LISP programmers, so that's not a relevant question.
Viewed from the other direction, it's hugely import. Why would a Python programmer adopt functional design patterns? That's the question that needs to be answered clearly.
And from the reviews of chapter 1, it wasn't addressed clearly enough.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.