On Sat, Mar 28, 2009 at 8:00 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
Greg Ewing wrote:
While attempting to update the PEP to incorporate a GeneratorReturn exception, I've thought of a potential difficulty in making the exception type depend on whether the return statement had a value.
Currently the StopIteration exception is created after the return statement has unwound the stack frame, by which time we've lost track of whether it had an expression.
Does it become easier if "return None" raises StopIteration instead of raising GeneratorReturn(None)?
I think I'd prefer that to having to perform major surgery on the eval loop to make it do something else... (Guido may have other ideas, obviously).
I think my first response on this (yesterday?) already mentioned that I didn't mind so much whether "return None" was treated more like "return" or more like "return <value>". So please do whatever can be implemented easily. -- --Guido van Rossum (home page: http://www.python.org/~guido/)