Yield after the return in Python function.

Dan Stromberg drsalists at gmail.com
Mon Apr 5 22:36:03 EDT 2021


On Mon, Apr 5, 2021 at 10:46 AM Terry Reedy <tjreedy at udel.edu> wrote:

> If there were a 'dead
> (unreachable) code' exception, a reader or compiler would have to
> analyze each use of 'yield' and decide whether it is reachable or not.
>

It's also subject to how hard the compiler feels like trying in any given
release.  Many compilers have simple unreachable code warnings.

But to do a 100% accurate job of yield detection would be equivalent to the
halting problem, which is a classic problem in computer science that cannot
be solved 100% accurately in finite time.


More information about the Python-list mailing list