[Python-ideas] Possible PEP 380 tweak
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Oct 29 00:43:19 CEST 2010
Nick Coghlan wrote:
> On Thu, Oct 28, 2010 at 6:52 PM, Jacob Holm <jh at improva.dk> wrote:
>>Looks like we are still not on exactly the same page though... You seem
>>to be arguing from the version at
>>http://www.python.org/dev/peps/pep-0380, whereas I am looking at
>>http://mail.python.org/pipermail/python-ideas/attachments/20090419/c7d72ba8/attachment-0001.txt,
>>which is newer.
>
> Still, the revised expansion also does the right thing in the case
> that was originally bothering me,
That attachment is slightly older than my own current draft,
which is attached below. The differences in the expansion are
as follows (- is the version linked to above, + is my current
version):
@@ -141,20 +141,21 @@
_s = yield _y
except GeneratorExit as _e:
try:
- _m = getattr(_i, 'close')
+ _m = _i.close
except AttributeError:
pass
else:
_m()
raise _e
except BaseException as _e:
+ _x = sys.exc_info()
try:
- _m = getattr(_i, 'throw')
+ _m = _i.throw
except AttributeError:
raise _e
else:
try:
- _y = _m(*sys.exc_info())
+ _y = _m(*_x)
except StopIteration as _e:
_r = _e.value
break
Does this version still address your concerns? If so, please
check it in as the latest version.
--
Greg
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: yield-from-rev14.txt
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101029/f8a1a501/attachment.txt>
More information about the Python-ideas
mailing list