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). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------