On Tue, Nov 25, 2014 at 10:12 AM, Isaac Schwabacher <[email protected]> wrote:
> On 11/25/14, Guido van Rossum wrote: > > On Tue, Nov 25, 2014 at 9:49 AM, Chris Angelico <[email protected] < > [email protected]')" target="1">[email protected]> wrote: > > > > > On Wed, Nov 26, 2014 at 4:45 AM, Isaac Schwabacher > > > <python.org/~guido(javascript:main.compose('new', 't= > [email protected]>> wrote: > > > > Yield can also raise StopIteration, if its thrown in. The current > interaction of generator.throw(StopIteration) with yield from cant be > emulated under the PEPs behavior, though its not clear that thats a problem. > > > > > > Hrm. I have *absolutely* no idea when you would use that, > > To close the innermost generator in a yield-from chain. No, I don't know > why you'd want to do that, either. For that purpose you should call the generator's close() method. This throws a GeneratorExit into the generator to give the generator a chance of cleanup (typically using try/finally). Various reasonable things happen if the generator misbehaves at this point -- if you want to learn what, read the code or experiment a bit on the command line (that's what I usually do). -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
