On Wed, Mar 3, 2021 at 8:21 AM Dieter Maurer <die...@handshake.de> wrote: > > Alan Gauld wrote at 2021-2-28 23:47 +0000: > >yield from () > > "yield from iterator" is similar to "for i in iterator: yield i" (with > special handling when data/exceptions are injected into the generator). > > Thus, "yield from ()" does essentially nothing with the side effect > that the containing function is treated as generator function. >
Another way to write the same thing is: if False: yield None This, too, will do nothing - in fact, it will be optimized out completely in current versions of CPython - but, again, will force the function to be a generator. ChrisA -- https://mail.python.org/mailman/listinfo/python-list