[Python-Dev] Return from generators in Python 3.2 (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Fri Aug 27 00:42:42 CEST 2010


On Fri, Aug 27, 2010 at 8:31 AM, Yury Selivanov <yselivanov at gmail.com> wrote:

All this proposal is suggesting is to replace SyntaxError with GeneratorReturn (or StopIteration).  I'd classify is as a minor change than some special refactoring that may fall under the moratorium.  Correct me if I'm wrong.

It's either a new builtin or affects the API of an existing builtin, and it is moving something from a compile time error to a runtime error. Things that fall under the moratorium aren't "special refactorings" - they're anything that affects the builtins or the language syntax, so trying to separate out this one part of PEP 380 fails on both counts.

Coroutine programmers have lived with the status quo for years already, putting up with it for a couple more until PEP 380 goes in isn't going to hurt them all that much.

On the GeneratorReturn vs StopIteration front, adding a new builtin exception is a big deal. "Newbie programmers might not notice that their return statement isn't doing anything" isn't a particularly good justification for adding one.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list