Oct. 21, 2012
2:46 a.m.
Guido van Rossum wrote:
In the PEP 380 world, there will be a new type of mistake possible: writing yield instead of yield from. Fortunately the scheduler can easily test for this -- if the result of its calling next() is not None, the user yielded something.
That will catch some mistakes of that kind, but not all -- it won't catch 'yield foo()' where foo() returns None. One way to fix that would be to require yielding some unique sentinel value. If the yields are all hidden inside primitives called with 'yield from', that could be kept an implementation detail. -- Greg