Title: Return from generators in Python 3.2
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.2
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Yury.Selivanov, amaury.forgeotdarc, eric.smith, georg.brandl
Priority: normal Keywords: patch

Created on 2010-08-26 21:58 by Yury.Selivanov, last changed 2010-09-01 21:42 by georg.brandl. This issue is now closed.

File name Uploaded Description Edit
generators_return.patch Yury.Selivanov, 2010-08-26 21:58
Messages (3)
msg115033 - (view) Author: Yury Selivanov (Yury.Selivanov) * Date: 2010-08-26 21:58
The patch is intended to fix behaviour of 'return' statement in python's generators.

Please read this message before looking at the patch.
msg115061 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-08-27 11:37
Why is a run-time exception better than a SyntaxError in this case?
And your patch now allows:
   x = None
   return x
What's the rationale of this change?
msg115336 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-09-01 21:42
Uh, if I understand correctly, this is akin to what PEP 380 does with generator returns, just with a different exception.

As such, if I'm not mistaken, it is a) a new language feature for after the moratorium and b) needs a competing PEP.
Date User Action Args
2010-09-01 21:42:14georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg115336

resolution: rejected
2010-08-27 11:37:07amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg115061
2010-08-26 22:54:39eric.smithsetnosy: + eric.smith
2010-08-26 21:58:52Yury.Selivanovcreate